In Dart, is it possible to create an object by parsing a map to constructor?
Example:
class User {
final String? id;
final String? name;
User({this.id, this.name});
}
// Using a map to initiate a `User` object, how to achieve similar functionality?
final map = {'id': '1323', 'name': 'foo'};
User foo = User(map);