objectCreators property Null safety

Map<String, dynamic Function(Map<String, dynamic>?)> objectCreators
override

Define functions that create new complex serializable or Map instances for nested objects. You can evaluate the provided map value to select a specific subclass, if needed.

  objectCreators['my-serializable'] = (map) => MySerializable();
  objectCreators['event'] = (map) => map['type'] == 0 ? StartEvent() : EndEvent();
  objectCreators['my-list'] = (map) => <String>[]; // for lists the map parameter will be null
  objectCreators['my-map'] = (map) => <int, MySerializable>{};
  objectCreators['my-map.value'] = (map) => MySerializable();

Implementation

@override
Map<String, dynamic Function(Map<String, dynamic>?)> get objectCreators =>
    _objectCreators;