useName function

String useName()

Get the page name from Hooks.

It is only available within the build method.

If there is no page name, an empty string will be returned.

Implementation

String useName() {
  final context = useContext();
  return ModalRoute.of(context)?.settings.name ?? "";
}