storageInitializerMock method Null safety

Future<_PersistStoreMock> storageInitializerMock()

Initialize a mock persistence provider.

Used for tests.

It is wise to clear the store in setUp method, to ensure a fresh store for each test

setUp(() {
 storage.clear();
});

Implementation

static Future<_PersistStoreMock> storageInitializerMock() async {
  _persistStateGlobalTest = _PersistStoreMock();
  await _persistStateGlobalTest?.init();
  return (_persistStateGlobalTest as _PersistStoreMock);
}