replaceScreen function
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,
),
);
}