Open verygoodstefan opened 3 months ago
Update: it turns out this does compile in pure Dart -- the root issue was my use of strict analysis rules in very_good_analysis.
Ignoring the Amplify-generated Dart code in analysis_options.yaml
solves the issue.
I'll keep this as a feature request to modify the generated code to be compliant with very_good_analysis. In the mean time (as you have mentioned), ignore the generated files from any code analysis tools that cause issues.
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: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?
Would this feature include a breaking change?