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 "comment":
        _comment = value as String;
        break;
      case "emote":
        _emote = value as String;
        break;
      case "photos":
        _photos = toList(value, (item) => IImageContent.fromJson(item));
        break;
      case "videos":
        _videos = toList(value, (item) => IVideoContent.fromJson(item));
        break;
      case "creator":
        _creator = IReliveItContact.fromJson(value);
        break;
      case "user":
        _user = MKey.fromJson(value);
        break;
      case "chain":
        _chain = toList(value, (item) => MKey.fromJson(item)!);
        break;
      case "content":
        _content = MKey.fromJson(value);
        break;
      default:
        break;
    }
  }
}