mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
22 lines
635 B
Dart
22 lines
635 B
Dart
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<Override> overrides = const [],
|
|
List<ProviderObserver>? 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;
|
|
} |