toDict method

  1. @override
Map<String, dynamic> toDict({
  1. List<String>? nonSaveKeys,
})

(en)Convert the object to a dictionary.

(ja)このクラスを辞書に変換します。

  • nonSaveKeys : If you specify a key that you don't want saved, that key and its contents will not be converted to a dictionary.

Implementation

@override
Map<String, dynamic> toDict({List<String>? nonSaveKeys}) {
  Map<String, dynamic> d = {};
  d['class_name'] = className;
  d['version'] = version;
  Map<String, double?> mMap = {};
  for (String i in _map.keys) {
    if (nonSaveKeys != null) {
      if (!nonSaveKeys.contains(i)) {
        mMap[i] = _map[i];
      }
    } else {
      mMap[i] = _map[i];
    }
  }
  d[_saveKey] = mMap;
  return d;
}