I am trying to use this package but got some errors when i run my app (flutter run)
Errors: (https://i.stack.imgur.com/fSq7U.png)
i added this line into build.gradle
buildscript {
ext.kotlin_version = '1.5.21'
repositories {
google() // Add this line to specify the Google Maven repository
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0' // Updated Gradle version
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
how i used it:
flutter_custom_tabs: ^1.1.1
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';
void _launchURL(BuildContext context) async {
try {
await launch(
'https://flutter.dev',
customTabsOption: CustomTabsOption(
toolbarColor: Theme.of(context).primaryColor,
enableDefaultShare: true,
enableUrlBarHiding: true,
showPageTitle: true,
extraCustomTabs: const <String>[
// ref. https://play.google.com/store/apps/details?id=org.mozilla.firefox
'org.mozilla.firefox',
// ref. https://play.google.com/store/apps/details?id=com.microsoft.emmx
'com.microsoft.emmx',
],
),
safariVCOption: SafariViewControllerOption(
preferredBarTintColor: Theme.of(context).primaryColor,
preferredControlTintColor: Colors.white,
barCollapsingEnabled: true,
entersReaderIfAvailable: false,
dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
),
);
} catch (e) {
// An exception is thrown if browser app is not installed on Android device.
debugPrint(e.toString());
}
}