ChromeSafariBrowser class
This class uses native Chrome Custom Tabs on Android and SFSafariViewController on iOS.
NOTE: If you want to use the ChromeSafariBrowser
class on Android 11+ you need to specify your app querying for
android.support.customtabs.action.CustomTabsService
in your AndroidManifest.xml
(you can read more about it here: https://developers.google.com/web/android/custom-tabs/best-practices#applications_targeting_android_11_api_level_30_or_above).
Supported Platforms/Implementations:
- Android
- iOS
Constructors
Properties
Methods
-
addMenuItem(
→ void ) - Adds a ChromeSafariBrowserMenuItem to the menu.
-
addMenuItems(
→ void ) - Adds a list of ChromeSafariBrowserMenuItem to the menu.
-
close(
) → Future< void> - Closes the ChromeSafariBrowser instance.
-
isOpened(
) → bool -
Returns
true
if the ChromeSafariBrowser instance is opened, otherwisefalse
. -
launchUrl(
{required WebUri url, Map< String, String> ? headers, List<WebUri> ? otherLikelyURLs, WebUri? referrer}) → Future<void> -
Tells the browser to launch with
url
. -
mayLaunchUrl(
{WebUri? url, List< WebUri> ? otherLikelyURLs}) → Future<bool> - Tells the browser of a likely future navigation to a URL. The most likely URL has to be specified first. Optionally, a list of other likely URLs can be provided. They are treated as less likely than the first one, and have to be sorted in decreasing priority order. These additional URLs may be ignored. All previous calls to this method will be deprioritized.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onClosed(
) → void - Event fired when the ChromeSafariBrowser is closed.
-
onCompletedInitialLoad(
bool? didLoadSuccessfully) → void - Event fired when the initial URL load is complete.
-
onInitialLoadDidRedirect(
WebUri? url) → void - Event fired when the initial URL load is complete.
- Event fired when a navigation event happens.
-
onOpened(
) → void - Event fired when the ChromeSafariBrowser is opened.
-
onRelationshipValidationResult(
CustomTabsRelationType? relation, WebUri? requestedOrigin, bool result) → void - Event fired when a relationship validation result is available.
-
onServiceConnected(
) → void - Event fired when the when connecting from Android Custom Tabs Service.
-
onWillOpenInBrowser(
) → void - Event fired when the user opens the current page in the default browser by tapping the toolbar button.
-
open(
{WebUri? url, Map< String, String> ? headers, List<WebUri> ? otherLikelyURLs, WebUri? referrer, ChromeSafariBrowserClassOptions? options, ChromeSafariBrowserSettings? settings}) → Future<void> -
Opens the ChromeSafariBrowser instance with an
url
. -
setActionButton(
ChromeSafariBrowserActionButton actionButton) → void - Set a custom action button.
-
setSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) → void - Sets the remote views displayed in the secondary toolbar in a custom tab.
-
throwIsAlreadyOpened(
{String message = ''}) → void -
throwIsNotOpened(
{String message = ''}) → void -
toString(
) → String -
A string representation of this object.
inherited
-
updateActionButton(
{required Uint8List icon, required String description}) → Future< void> - Updates the ChromeSafariBrowserActionButton.icon and ChromeSafariBrowserActionButton.description.
-
updateSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) → Future< void> - Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session.
-
validateRelationship(
{required CustomTabsRelationType relation, required WebUri origin}) → Future< bool> - Requests to validate a relationship between the application and an origin.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- debugLoggingSettings ↔ DebugLoggingSettings
-
Debug settings.
getter/setter pair
Static Methods
-
clearWebsiteData(
) → Future< void> - Clear associated website data accrued from browsing activity within your app. This includes all local storage, cached resources, and cookies.
-
getMaxToolbarItems(
) → Future< int> - The maximum number of allowed secondary toolbar items.
-
invalidatePrewarmingToken(
PrewarmingToken prewarmingToken) → Future< void> - Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens.
-
isAvailable(
) → Future< bool> -
On Android, returns
true
if Chrome Custom Tabs is available. On iOS, returnstrue
if SFSafariViewController is available. Otherwise returnsfalse
. -
prewarmConnections(
List< WebUri> URLs) → Future<PrewarmingToken?> - Prewarms a connection to each URL. SFSafariViewController will automatically use a prewarmed connection if possible when loading its initial URL.