fake static method

FakeVaultService fake([
  1. Map<String, String> initialValues = const {}
])

Swap the vault service with a FakeVaultService for testing.

Returns the fake so tests can inspect recorded operations and run assertions.

final fake = Vault.fake({'token': 'seed_value'});
await Vault.put('key', 'value');
fake.assertWritten('key');

Implementation

static FakeVaultService fake([Map<String, String> initialValues = const {}]) {
  final driver = FakeVaultService(initialValues);
  Magic.app.setInstance('vault', driver);
  return driver;
}