runWithConfiguration<T> static method

T runWithConfiguration<T>(
  1. T body(), {
  2. required GoldenToolkitConfiguration config,
})

Applies a GoldenToolkitConfiguration to a block of code to effectively provide a scoped singleton. The configuration will apply to just the injected body function.

In most cases, this can be applied in your flutter_test_config.dart to wrap every test in its own zone

Implementation

static T runWithConfiguration<T>(
  T Function() body, {
  required GoldenToolkitConfiguration config,
}) {
  return runZoned<T>(
    body,
    zoneValues: <dynamic, dynamic>{#goldentoolkit.config: config},
  );
}