You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to make code much shorter without use JsonConverter. While factory fromJson cannot return null I need to use static fromJson instead. But, g.dart file didn't provide what i want.
The difference is that, why static fromJson generate with DiIcon.fromJson(json['icon'] as Map<String, dynamic>) and factory fromJson generate with DiIcon.fromJson(json['icon']) while both static and factory fromJson have same parameter data type Object? json
The problem is that, it no error when i use with factory if json['icon'] not Map<String, dynamic> but it will when i use with static because DiIcon.fromJson(json['icon'] as Map<String, dynamic>)
One more thing, it save me a lot of time if compare with implements JsonConverter while my purpose just check json data type and return null is invalid.
The text was updated successfully, but these errors were encountered:
I want to make code much shorter without use JsonConverter. While factory fromJson cannot return null I need to use static fromJson instead. But, g.dart file didn't provide what i want.
Example with factory:
Inside di.category.g.dart
Example with static:
Inside di.category.g.dart
The text was updated successfully, but these errors were encountered: