amplify-codegen
amplify-codegen copied to clipboard
Support Amplify Codegen In Pure Dart Projects
Describe the feature you'd like to request
It would be nice to have the ability to leverage features of Amplify Gen 2 (particularly the graphql model gen) in pure Dart packages, in addition to in Flutter projects. This would allow devs to integrate new Amplify features in projects and create packages that could be used in multiple Flutter apps, instead of being bound to a single app.
Currently, this is not possible because of how GraphQL model code is generated into Dart. Specifically, this generated constructor passes in a Flutter app, but throws a field_initializer_not_assignable error in a Dart app:
const Todo._internal({required this.id, content, createdAt, updatedAt}): _content = content, _createdAt = createdAt, _updatedAt = updatedAt;
Describe the solution you'd like
It would be nice if the codegen that generates Dart code from the backend schema generates code that is supported in pure Dart packages.
Describe alternatives you've considered
The only alternative I can think of would be to only use Amplify on Flutter apps, not Dart packages, which would require repeating schema definitions across multiple Dart projects, and prohibit abstracting model generation within app architecture.
Additional context
No response
Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
Would this feature include a breaking change?
- [ ] ⚠️ This feature might incur a breaking change