Is there any *? operator in dart?
I am using copy_with_extension to generate codes, Currently I have error like
[SEVERE] copy_with_extension_gen:copy_with_extension_gen on lib/models/my_model.dart:
An error `FormatterException` occurred while formatting the generated source for
`package:app/models/my_model.dart`
which was output to
`lib/models/my_model.copyWith.g.part`.
This may indicate an issue in the generator, the input source code, or in the
source formatter.
Could not format because the source could not be parsed:
line 8, column 51 of .: Expected to find '}'.
╷
8 │ MyModel copyWith({ String*? myField})
{
│ ^
╵
*? is weird , ? is for nullable , What is * ?
As I am using sdk: ">=2.7.0 <3.0.0" and too busy to migrate null safety, I want to fork and change to unsound null safety
CodePudding user response:
There is no *? operator in Dart. Your code generator is generating invalid code, the * cannot occur where it does.
This is likely the code generator being tripped up by changes to the analyzer.
The type String* could be an internal representation of an unsound nullable type (the classical String type in pre-nullsafetyp code which can be null, not the null-safe String which can't).
The code generator should emit the correct source name, not the internal representation. I'd file an issue with that code generator.
