pushAndRemove function

Future pushAndRemove (
  1. BuildContext context,
  2. Widget widget
)

Implementation

Future<dynamic> pushAndRemove(BuildContext context, Widget widget){
  return Navigator.of(context).pushAndRemoveUntil(
    MaterialPageRoute(
      builder: (context) => widget,
    ),
    (route) => route == null
  );
}