replaceScreen function

Future replaceScreen({
  1. required BuildContext context,
  2. required Widget screen,
})

More readable than Navigator function spelled out

Implementation

Future<dynamic> replaceScreen({
  required BuildContext context,
  required Widget screen,
}) {
  return Navigator.of(context).pushReplacement(
    platformPageRoute(
      context: context,
      builder: (context) => screen,
    ),
  );
}