dart-data-plugin icon indicating copy to clipboard operation
dart-data-plugin copied to clipboard

Parses DateTime throws error.

Open marcusedu opened this issue 4 years ago • 1 comments

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
      );
  }
}

marcusedu avatar Sep 14 '21 19:09 marcusedu

Is anyone still working on this?

nomoruyi avatar Feb 02 '24 09:02 nomoruyi