pushClear<T extends ChangeNotifier> function Null safety

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

Implementation

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