takeFromMap method

  1. @override
void takeFromMap(
  1. Map<String, dynamic>? from,
  2. {bool copyEntries = true}
)
override

Used for meta-forms in setting deep properties

Implementation

@override
void takeFromMap(Map<String, dynamic>? from, {bool copyEntries = true}) {
  if (from == null) return;

  super.takeFromMap(from, copyEntries: copyEntries);
  for (final entry in from.entries) {
    final key = entry.key;
    final value = entry.value;
    if (value == null) continue;
    switch (key) {
      case "ref":
        _ref = MSchemaRef.fromJson(value);
        break;
      case "mschema":
        _mschema = IMSchemaDefinition.fromJson(value);
        break;
      case "recordType":
        _recordType = MSchemaRef.fromJson(value);
        break;
      case "category":
        _category = value as String;
        break;
      case "templates":
        _templates =
            toMap(value, (item) => IFactSchemaTemplate.fromJson(item)).cast();
        break;
      case "icon":
        _icon = value as String;
        break;
      case "tenses":
        _tenses = toList(value, (item) => IFactTense.fromJson(item)!);
        break;
      case "factTokens":
        _factTokens = (value as List).cast<String>();
        break;
      case "bundle":
        _bundle = value as String;
        break;
      case "dates":
        _dates = toList(value, (item) => IFactMetaDate.fromJson(item));
        break;
      case "links":
        _links = toList(value, (item) => IFactLink.fromJson(item));
        break;
      case "duration":
        _duration = IFactDuration.fromJson(value);
        break;
      case "isSingleton":
        _isSingleton = value as bool;
        break;
      case "isAttribute":
        _isAttribute = value as bool;
        break;
      default:
        break;
    }
  }
}