I use the location package and when I start the app I get this message:
Plugin project :location_web not found. Please update settings.gradle.
But everything works fine, what I found in this post: Plugin project :location_web not found. Please update settings.gradle. How do I fix this? is that I should put this in my Settings.gradle:
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
but this leads to my question my app works just fine and I have no clue what this code above does, so I am not really happy with putting something I don't understand my app.
So could the above error message lead to some bigger problems in the future or can I just leave it?
I reproduced this error message with the below code:
import 'package:flutter/material.dart';
import 'package:location/location.dart';
void main() => runApp(MaterialApp(home: GapNap()));
class GapNap extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
child: Text('go to new screen'),
onPressed: () {
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => NewScreen()));
},
),
),
);
}
}
class NewScreen extends StatefulWidget {
@override
_NewScreenState createState() => _NewScreenState();
}
class _NewScreenState extends State<NewScreen> {
@override
void initState() {
super.initState();
init();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(child: Text('jo')),
);
}
Future<void> init() async {
await getLocation();
print(currentLocation.latitude);
}
final Location _location = Location();
UserLocation currentLocation;
Future<UserLocation> getLocation() async {
try {
var userLocation = await _location.getLocation();
currentLocation = UserLocation(
latitude: userLocation.latitude, longitude: userLocation.longitude);
print('Location was succesfully found');
} catch (e) {
print('Coould not get the Location $e');
}
return currentLocation;
}
}
class UserLocation {
final double latitude;
final double longitude;
UserLocation({this.latitude, this.longitude});
}
Note: the message is shown when I start the app not when I am trying to get the location. Output is:
Launching lib\ReproduceMyError.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Plugin project :location_web not found. Please update settings.gradle.
√ Built build\app\outputs\flutter-apk\app-debug.apk.