to static method

dynamic to(
  1. BuildContext context,
  2. String routeName, {
  3. dynamic arguments,
  4. dynamic result(
    1. Result result
    )?,
})

Navigate to another screens

Implementation

static to(BuildContext context, String routeName,
    {dynamic arguments, Function(Result result)? result}) {
  Navigator.pushNamed(context, routeName, arguments: arguments).then((res) {
    if (res != null) {
      result!(res as Result);
    }
  });
}