Closed kyujihub closed 3 years ago
Thank you for report. I will check.
@kyujihub Please tell me model class before and after.
I will send you the source code before and after the change. code.zip
I'm facing the same issue.
My workaround was change manually the generated flamingo.dart, adding a "?":
FROM
void _$fromData(FileContentLine doc, Map<String, dynamic> data) {
doc.type = Helper.valueFromKey<String>(data, 'type');
TO
void _$fromData(FileContentLine doc, Map<String, dynamic> data) {
doc.type = Helper.valueFromKey<String?>(data, 'type');
I modified this bug. Please update flamingo_generator in latest version And then run build_runner.
flutter pub run build_runner build --delete-conflicting-outputs
Nice to meet you, my name is kyuji.
We are evaluating flamingo, but if the field increases in the model, refer to the data before the increase. I get the error "Expected a value of type'String', but got one of type'Null'". It seems to occur when there is no corresponding Field in Helper.valueFromKey in _ $ fromData (this, data). Is it possible to set Null when there is no Field? Or is it used incorrectly?
-- Japanese -- flamingoの評価をしておりますが、modelにFieldが増えた場合、増える前のデータを参照すると 「Expected a value of type 'String', but got one of type 'Null'」のエラーが発生します。 _$fromData(this, data)内の、Helper.valueFromKeyで、該当Fieldがない時に発生するようです。 Fieldがない場合に、Nullを設定する事は可能でしょうか。 それとも、使用方法が間違っていますでしょうか。
以上、宜しくお願い致します。