【自用】 flutter page router

【自用】 flutter page router

void pagePush(BuildContext c, Widget v, {bool remove = false}) {
  if (!remove) {
    Navigator.push(
      c,
      MaterialPageRoute(builder: (context) => v),
    );
  } else {
    Navigator.pushAndRemoveUntil(
      c,
      MaterialPageRoute(builder: (context) => v),
      (route) => route == null,
    );
  }
}


 

    PS:自用的  不做解释                        作者:一个吃货帅锅