install static method

void install({
  1. Object? responseFactory(
    1. Request request
    )?,
  2. MockResponder? responder,
  3. Map<String, Object> storageValues = const <String, Object>{},
  4. DateTime clock()?,
  5. BifrostNotificationRecorder? notifications,
  6. BifrostInternalDiagnosticRecorder? diagnostics,
  7. bool dispatchNotifications = false,
  8. FutureOr<void> initializeApplication()?,
})

Declares the per-test lifecycle once in flutter_test_config.dart.

initializeApplication runs after Bifrost has installed a fresh mock transport and preference store, so async services resolve the test store rather than retaining a handle created before the reset.

Implementation

static void install({
  Object? Function(http.Request request)? responseFactory,
  MockResponder? responder,
  Map<String, Object> storageValues = const <String, Object>{},
  DateTime Function()? clock,
  BifrostNotificationRecorder? notifications,
  BifrostInternalDiagnosticRecorder? diagnostics,
  bool dispatchNotifications = false,
  FutureOr<void> Function()? initializeApplication,
}) {
  _validateTransport(responseFactory, responder);
  flutter_test.setUp(() async {
    reset(
      responseFactory: responseFactory,
      responder: responder,
      storageValues: storageValues,
      clock: clock,
      notifications: notifications,
      diagnostics: diagnostics,
      dispatchNotifications: dispatchNotifications,
    );
    await initializeApplication?.call();
  });
}