replaceWithProviders<R> method
Replace the current screen while preserving the current provider container
Implementation
Future<R?> replaceWithProviders<R>(Widget destination) {
// Get the current provider container
final container = ProviderScope.containerOf(context);
return Navigator.of(context).pushReplacement<R, dynamic>(
MaterialPageRoute(
builder: (context) => UncontrolledProviderScope(
container: container,
child: destination,
),
),
);
}