toSerializableMap method

Map toSerializableMap()
inherited

Get the state of this provider as map to be serialized

Implementation

Map toSerializableMap() {
  var values = Map<String, dynamic>();

  for (var v in _values.keys) {
    var qudsValue = _values[v]!;

    if (qudsValue.serializable != false) {
      var value;
      if (qudsValue.isListNotifier) {
        var lst = (qudsValue._listNotifier as QudsListNotifier)._list;
        value = lst.map((e) {
          var isSerializable = e is QudsSerializable;
          var json = isSerializable ? e.toJson() : e;
          return json;
        }).toList();
      } else {
        value = qudsValue._valueNotifier!.value is QudsSerializable
            ? qudsValue._valueNotifier!.value.toJson()
            : qudsValue._valueNotifier!.value;
      }
      values[v] = value;
    }
  }
  var result = {
    'provider_type': this.runtimeType.toString(),
    'values': values
  };
  return result;
}