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 "operationRef": _operationRef = MOperationRef.fromJson(value); break;
      case "implements_": _implements_ = MOperationRef.fromJson(value); break;
      case "owningType": _owningType = MSchemaRef.fromJson(value); break;
      case "operationLabel": _operationLabel = value as String; break;
      case "operationDescription": _operationDescription = value as String; break;
      case "isAssisted": _isAssisted = value as bool; break;
      case "isVirtual": _isVirtual = value as bool; break;
      case "realm": _realm = value as String; break;
      case "requiredTokens": _requiredTokens = (value as List).cast<String>(); break;
      case "inputSchema": _inputSchema = IMSchemaDefinition.fromJson(value); break;
      case "outputSchema": _outputSchema = IMSchemaDefinition.fromJson(value); break;
      case "initSchema": _initSchema = IMSchemaDefinition.fromJson(value); break;
      default: break;
    }
  }
}