enter image description hereI am building an application that uses firebase and share the content of the application
The app was working fine and when I added the firebase packages I got errors:
MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher)
MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/share)
MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/google_mobile_ads)
I have tried more than one method (flutter clean) many times (flutter pub get) many times (flutter run) (reinstall app) many times I searched for solutions but it didn't work
class Home extends StatefulWidget {
static String id = 'HomeScreen';
const Home({Key? key}) : super(key: key);
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<Home> {
Future<InitializationStatus> _initGoogleMobileAds() {
return MobileAds.instance.initialize();
}
late BannerAd _bannerAd;
bool _isBannerAdReady = false;
@override
void initState() {
_bannerAd = BannerAd(
adUnitId: AdHelper.bannerAdUnitId,
request: AdRequest(),
size: AdSize.banner,
listener: BannerAdListener(
onAdLoaded: (_) {
setState(() {
_isBannerAdReady = true;
});
},
onAdFailedToLoad: (ad, err) {
print('Failed to load a banner ad: ${err.message}');
_isBannerAdReady = false;
ad.dispose();
},
),
);
_bannerAd.load();
enter image description here}
@override
void dispose() {
_bannerAd.dispose();
super.dispose();
}}
I added ads in same class that has _launchUrl()
_launchURL() async {
const url = 'url';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
and _share() method also
onTap: () {
Share.share(appUrl);
},
canLaunch()?