skip to Main Content

I want to convert some address to coordinates but I am getting this MissingPluginException error and it is caused by my locationFromAddress call and it prevents the navigator to function.
The code worked properly before I added locationFromAddress. What can this error mean and how do I fix this?
Error: MissingPluginException(No implementation found for method locationFromAddress on channel flutter.baseflow.com/geocoding)

my code

`import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:geolocator/geolocator.dart';
import 'package:geocoding/geocoding.dart';

@OverRide
void didChangeDependencies() {
super.didChangeDependencies();
SchedulerBinding.instance.addPostFrameCallback((_) async {
userPosition = await getUserPosition();
locs = await GeocodingPlatform.instance.locationFromAddress('my address');
loc = locs.first;
if (context.mounted) {
Navigator.pushReplacementNamed(context, 'map', arguments: {
'userPosition': userPosition,
'loc': loc,
});
}
});
}

Position? userPosition;
Location? loc;
List locs = [];

@OverRide
Widget build(BuildContext context) {...}`

2

Answers


  1. You need to rerun your application, if you add a package which adds native features.

    Close your app (not hot reload/ hot restart) completely and rerun it.

    Login or Signup to reply.
  2. flutter clean

    flutter pub get

    run those commands and rerun your application

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search