pushReplacement<T extends ChangeNotifier> function Null safety

void pushReplacement<T extends ChangeNotifier>(
  1. Widget screen,
  2. [T? provider]
)

Implementation

void pushReplacement<T extends ChangeNotifier>(Widget screen, [T? provider]) {
  Navigator.of(Get.context!).pushReplacement(
    MaterialPageRoute(
      builder: (_) {
        return provider != null
            ? ChangeNotifierProvider(create: (_) => provider, child: screen)
            : screen;
      },
    ),
  );
}