popAndPushScreen function
More readable than Navigator function spelled out
Implementation
Future<dynamic> popAndPushScreen({
required BuildContext context,
required Widget screen,
}) {
Navigator.of(context).pop();
return Navigator.of(context).push(
platformPageRoute(
context: context,
builder: (context) => screen,
),
);
}