Reputation: 832
So I don't know how to explain this problem , but it has to do with the flutter custom Tabs and the deprecations. after running this code I get an error:
Future openLinkWithCustomTab(BuildContext context, String url) async {
try {
await FlutterWebBrowser.openWebPage(
url: url,
customTabsOptions: CustomTabsOptions(
colorScheme: context.read<ThemeBloc>().darkTheme!
? CustomTabsColorScheme.dark
: CustomTabsColorScheme.light,
shareState: const CustomTabsShareState.enabled(),
instantAppsEnabled: true,
showTitle: true,
urlBarHidingEnabled: true,
),
safariVCOptions: const SafariViewControllerOptions(
barCollapsingEnabled: true,
dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
modalPresentationCapturesStatusBarAppearance: true,
),
);
} catch (e) {
openToast1(context, 'Cant launch the url');
debugPrint(e.toString());
}
}
this is the error: lib/services/app_service.dart:66:29: Error: Enums can't be instantiated. shareState: const CustomTabsShareState.enabled(), ^^^^^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Where: Script 'E:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'E:\Flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Upvotes: 0
Views: 578
Reputation: 2120
Replace const CustomTabsShareState.enabled()
with CustomTabsShareState.enabled
.
I can not find enabled
definition in CustomTabsShareState
:
So maybe you are using the wrong one. Try to change to CustomTabsShareState.on
.
Refer to Enumerated types for more info.
Upvotes: 1