andrasferenczi / dart-data-plugin

IDEA plugin for generating utility methods for Dart data classes
148 stars 31 forks source link

Parses DateTime throws error. #21

Open marcusedu opened 3 years ago

marcusedu commented 3 years ago

The plugin does not handle DateTime parser correctly

class Person{
  String? name;
  DateTime? birthday;
  // Constructos and other relevant code.
  factory Person.fromMap(Map<String, dynamic> map){
    return Person(
        name: map['name'] as String?,
        birthday: DateTime.tryParse(map['birthday']), // Use this instead of map['birthday'] as DateTime
      );
  }
}
nomoruyi commented 9 months ago

Is anyone still working on this?