import 'package:riverpod/riverpod.dart'; import 'package:test/test.dart'; /// A testing utility which creates a [ProviderContainer] and automatically /// disposes it at the end of the test. ProviderContainer createContainer({ ProviderContainer? parent, List overrides = const [], List? observers, }) { // Create a ProviderContainer, and optionally allow specifying parameters. final container = ProviderContainer( parent: parent, overrides: overrides, observers: observers, ); // When the test ends, dispose the container. addTearDown(container.dispose); return container; }