takeFromMap method Null safety

  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 "type": _type = value as String; break;
      case "path": _path = value as String; break;
      case "label": _label = value as String; break;
      case "description": _description = value as String; break;
      case "uri": _uri = uriOf(value as String); break;
      case "baseCode": _baseCode = value as String; break;
      case "isRequired": _isRequired = value as bool; break;
      default: break;
    }
  }
}