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 "displayDate":
        _displayDate = dateTimeOf(value);
        break;
      case "dueDate":
        _dueDate = dateTimeOf(value);
        break;
      case "completionDate":
        _completionDate = dateTimeOf(value);
        break;
      case "taskTitle":
        _taskTitle = value as String;
        break;
      case "taskDescription":
        _taskDescription = value as String;
        break;
      case "timeSensitivity":
        _timeSensitivity = ITimeSensitivity.fromJson(value);
        break;
      case "isCancelled":
        _isCancelled = value as bool;
        break;
      case "dueConfig":
        _dueConfig = ITaskDueConfig.fromJson(value);
        break;
      case "displayOffset":
        _displayOffset = TimeSpan.fromJson(value);
        break;
      case "isAlert":
        _isAlert = value as bool;
        break;
      case "isSkippable":
        _isSkippable = value as bool;
        break;
      case "state":
        _state = value as MModel;
        break;
      case "result":
        _result = value as MModel;
        break;
      case "operationRef":
        _operationRef = MOperationRef.fromJson(value);
        break;
      case "isUnread":
        _isUnread = value as bool;
        break;
      case "isNotified":
        _isNotified = value as bool;
        break;
      case "setup":
        _setup = value as MModel;
        break;
      default:
        break;
    }
  }
}