LocalValueImpl<T> constructor
const
LocalValueImpl<T> ({
- DocumentType? documentType,
- Map<
String, dynamic> toJson(- T
- T fromJson()?,
- List<
String> ? basePath, - required Future<
LocalDataContainer> localDataContainerCreator(- DocumentType documentType,
- String fileName
Implementation
const LocalValueImpl({
DocumentType? documentType,
final Map<String, dynamic> Function(T)? toJson,
final T Function(Map<String, dynamic>)? fromJson,
final List<String>? basePath,
required final Future<LocalDataContainer> Function(
DocumentType documentType, String fileName)
localDataContainerCreator,
}) : assert(
(toJson == null && fromJson == null) ||
(toJson != null && fromJson != null),
'a toJson must have a corresponding fromJson and visa versa.'),
assert(
toJson != null ||
(T == double ||
T == int ||
T == String ||
T == Map<String, dynamic>),
'Must have custom toJson and fromJson if not using a json primative (int, double, string, or Map<String, dynamic>).'),
_documentType = kIsWeb
? DocumentType.prefs
: (documentType ?? DocumentType.document),
_toJson = toJson,
_fromJson = fromJson,
_basePath = basePath ?? const [],
_localDataContainerCreator = localDataContainerCreator;