currentRouteName property

String? get currentRouteName

Name of the current route, if it has one.

Implementation

static String? get currentRouteName => ModalRoute.of(context)?.settings.name;