getPackageName method

Future<String?> getPackageName({
  1. List<String>? packages,
  2. bool ignoreDefault = false,
})

Returns the preferred package to use for Custom Tabs. The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs. To modify this preferred behavior, set ignoreDefault to true and give a non empty list of package names in packages. This method queries the PackageManager to determine which packages support the Custom Tabs API. On apps that target Android 11 and above, this requires adding the following package visibility elements to your manifest.

packages – Ordered list of packages to test for Custom Tabs support, in decreasing order of priority.

ignoreDefault – If set, the default VIEW handler won't get priority over other browsers.

Returns the preferred package name for handling Custom Tabs, or null.

Officially Supported Platforms/Implementations:

Implementation

Future<String?> getPackageName(
    {List<String>? packages, bool ignoreDefault = false}) {
  throw UnimplementedError(
      'getPackageName is not implemented on the current platform');
}