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 "occasion":
        _occasion = value as String;
        break;
      case "gift":
        _gift = value as String;
        break;
      case "notes":
        _notes = value as String;
        break;
      case "giftDate":
        _giftDate = dateTimeOf(value);
        break;
      case "gifteeKeys":
        _gifteeKeys = toList(value, (item) => MKey.fromJson(item)!);
        break;
      case "recipientKey":
        _recipientKey = MKey.fromJson(value);
        break;
      default:
        break;
    }
  }
}