newGenericVault<T> method

  1. @override
Future<Vault<T>> newGenericVault<T>(
  1. Store<VaultInfo, VaultEntry> store, {
  2. String? name,
  3. dynamic fromEncodable(
    1. Map<String, dynamic>
    )?,
  4. VaultLoader<T>? vaultLoader,
  5. Clock? clock,
  6. EventListenerMode? eventListenerMode,
  7. bool? statsEnabled,
  8. VaultStats? stats,
})
override

Builds a new Vault

  • store: The Store that will back this Vault
  • name: The name of the vault
  • fromEncodable: The function that converts between the Map representation of the object and the object itself.
  • vaultLoader: The VaultLoader that should be used to fetch a new value upon absence
  • clock: The source of time to be used on this, defaults to the system clock if not provided
  • eventListenerMode: The event listener mode of this vault
  • statsEnabled: If statistics should be collected, defaults to false
  • stats: The statistics instance

Returns a new GenericVault

Implementation

@override
Future<Vault<T>> newGenericVault<T>(Store<VaultInfo, VaultEntry> store,
    {String? name,
    dynamic Function(Map<String, dynamic>)? fromEncodable,
    VaultLoader<T>? vaultLoader,
    Clock? clock,
    EventListenerMode? eventListenerMode,
    bool? statsEnabled,
    VaultStats? stats}) {
  final vault = GenericVault<T>(store,
      manager: this,
      name: name,
      clock: clock,
      vaultLoader: vaultLoader,
      eventListenerMode: eventListenerMode,
      statsEnabled: statsEnabled,
      stats: stats);
  _vaults[vault.name] = vault;

  return store
      .create(vault.name, fromEncodable: fromEncodable)
      .then((_) => vault);
}