andrasferenczi/dart-data-plugin

Parses DateTime throws error.

Opened this issue · 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
      );
  }
}

Is anyone still working on this?