LocalSingleton<T> constructor

const LocalSingleton<T>({
  1. required String id,
  2. DocumentType? documentType,
  3. T fromJson(
    1. Map<String, dynamic>
    )?,
  4. Map<String, dynamic> toJson(
    1. T
    )?,
})

Local persistance container for singletons.

LocalSingleton will always save to the same base path and offers no variability; consider LocalValue when storing to different paths (ex. storing users by ID).

see LocalValue for explinations on toJson fromJson, and documentType.

Implementation

const LocalSingleton(
    {required this.id,
    DocumentType? documentType,
    T Function(Map<String, dynamic>)? fromJson,
    Map<String, dynamic> Function(T)? toJson})
    : super(
          documentType: documentType,
          fromJson: fromJson,
          toJson: toJson,
          localDataContainerCreator: LocalDataContainer.create);