map<T> static method
Creates a persistent map state container.
Implementation
static PersistroMastro<Map<String, T>> map<T>(
String key, {
required Map<String, T> initial,
required T Function(dynamic) fromJson,
bool autoSave = true,
}) {
return PersistroMastro<Map<String, T>>(
key: key,
initial: initial,
decoder: (json) => Map<String, T>.from(
jsonDecode(json).map((k, v) => MapEntry(k, fromJson(v))),
),
encoder: (value) => jsonEncode(value),
autoSave: autoSave,
);
}