newGenericVault<T> method
Future<Vault<T> >
newGenericVault<T>(
- Store<
VaultInfo, VaultEntry> store, { - String? name,
- dynamic fromEncodable()?,
- VaultLoader<
T> ? vaultLoader, - Clock? clock,
- EventListenerMode? eventListenerMode,
- bool? statsEnabled,
- VaultStats? stats,
override
Builds a new Vault
store
: The Store that will back this Vaultname
: The name of the vaultfromEncodable
: 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 absenceclock
: The source of time to be used on this, defaults to the system clock if not providedeventListenerMode
: The event listener mode of this vaultstatsEnabled
: If statistics should be collected, defaults to falsestats
: 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);
}