showLicensePage function Null safety

void showLicensePage(
  1. {required BuildContext context,
  2. String? applicationName,
  3. String? applicationVersion,
  4. Widget? applicationIcon,
  5. String? applicationLegalese,
  6. bool useRootNavigator = false}
)

Displays a LicensePage, which shows licenses for software used by the application.

The application arguments correspond to the properties on LicensePage.

The context argument is used to look up the Navigator for the page.

The useRootNavigator argument is used to determine whether to push the page to the Navigator furthest from or nearest to the given context. It is false by default.

If the application has a Drawer, consider using AboutListTile instead of calling this directly.

The AboutDialog shown by showAboutDialog includes a button that calls showLicensePage.

The licenses shown on the LicensePage are those returned by the LicenseRegistry API, which can be used to add more licenses to the list.

Implementation

void showLicensePage({
  required BuildContext context,
  String? applicationName,
  String? applicationVersion,
  Widget? applicationIcon,
  String? applicationLegalese,
  bool useRootNavigator = false,
}) {
  assert(context != null);
  assert(useRootNavigator != null);
  Navigator.of(context, rootNavigator: useRootNavigator).push(MaterialPageRoute<void>(
    builder: (BuildContext context) => LicensePage(
      applicationName: applicationName,
      applicationVersion: applicationVersion,
      applicationIcon: applicationIcon,
      applicationLegalese: applicationLegalese,
    ),
  ));
}