Ошибка: < /p>
The named parameter 'settings' isn't defined.
< /code>
Код: < /p>
Future
getCurrentLocation() async {
if (_permissionStatus != LocationPermission.always && _permissionStatus != LocationPermission.whileInUse) {
await checkLocationPermissions();
if (_permissionStatus != LocationPermission.always && _permissionStatus != LocationPermission.whileInUse) {
return null;
}
}
try {
return await Geolocator.getCurrentPosition(settings: const LocationSettings(accuracy: LocationAccuracy.high));
} catch (e) {
//print("Error getting location: $e");
return null;
}
}
< /code>
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
http: ^1.4.0
geolocator: ^14.0.1
< /code>
Я запустил их, чтобы обновить кэш. < /p>
flutter clean
flutter pub cache repair
flutter pub get
< /code>
Я запустил Flutter Doctor -v < /p>
[√] Flutter (Channel stable, 3.32.1, on Microsoft Windows [Version 10.0.22000.3260], locale en-US) [548ms]
• Flutter version 3.32.1 on channel stable at C:\Users\nicholdw\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b25305a883 (3 weeks ago), 2025-05-29 10:40:06 -0700
• Engine revision 1425e5e9ec
• Dart version 3.8.1
• DevTools version 2.45.1
[√] Windows Version (11 Enterprise 64-bit, 21H2, 2009) [2.6s]
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [3.3s]
• Android SDK at C:\Users\nicholdw\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.1
• Java binary at: C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot\bin\java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Temurin-17.0.15+6 (build 17.0.15+6)
• All Android licenses accepted.
[√] Chrome - develop for the web [186ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.14.6 (June 2025)) [184ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise
• Visual Studio Enterprise 2022 version 17.14.36212.18
• Windows 10 SDK version 10.0.26100.0
[√] Android Studio (version 2024.3.2) [26ms]
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
[√] VS Code (version 1.101.0) [24ms]
• VS Code at C:\Users\nicholdw\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.112.0
[√] Connected device (4 available) [555ms]
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 16 (API 36) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.3260]
• Chrome (web) • chrome • web-javascript • Google Chrome 137.0.7151.104
• Edge (web) • edge • web-javascript • Microsoft Edge 137.0.3296.83
[√] Network resources [481ms]
• All expected network resources are available.
• No issues found!
Подробнее здесь: https://stackoverflow.com/questions/796 ... n-invoking
Как исправить ошибку: именованный параметр «Настройки» не определяется при вызове Geolocator.getCurrentPosition ⇐ Android
Форум для тех, кто программирует под Android
1750258837
Anonymous
Ошибка: < /p>
The named parameter 'settings' isn't defined.
< /code>
Код: < /p>
Future
getCurrentLocation() async {
if (_permissionStatus != LocationPermission.always && _permissionStatus != LocationPermission.whileInUse) {
await checkLocationPermissions();
if (_permissionStatus != LocationPermission.always && _permissionStatus != LocationPermission.whileInUse) {
return null;
}
}
try {
return await Geolocator.getCurrentPosition(settings: const LocationSettings(accuracy: LocationAccuracy.high));
} catch (e) {
//print("Error getting location: $e");
return null;
}
}
< /code>
pubspec.yaml:
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
http: ^1.4.0
geolocator: ^14.0.1
< /code>
Я запустил их, чтобы обновить кэш. < /p>
flutter clean
flutter pub cache repair
flutter pub get
< /code>
Я запустил Flutter Doctor -v < /p>
[√] Flutter (Channel stable, 3.32.1, on Microsoft Windows [Version 10.0.22000.3260], locale en-US) [548ms]
• Flutter version 3.32.1 on channel stable at C:\Users\nicholdw\dev\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b25305a883 (3 weeks ago), 2025-05-29 10:40:06 -0700
• Engine revision 1425e5e9ec
• Dart version 3.8.1
• DevTools version 2.45.1
[√] Windows Version (11 Enterprise 64-bit, 21H2, 2009) [2.6s]
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [3.3s]
• Android SDK at C:\Users\nicholdw\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.1
• Java binary at: C:\Program Files\Eclipse Adoptium\jdk-17.0.15.6-hotspot\bin\java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment Temurin-17.0.15+6 (build 17.0.15+6)
• All Android licenses accepted.
[√] Chrome - develop for the web [186ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.14.6 (June 2025)) [184ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise
• Visual Studio Enterprise 2022 version 17.14.36212.18
• Windows 10 SDK version 10.0.26100.0
[√] Android Studio (version 2024.3.2) [26ms]
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
[√] VS Code (version 1.101.0) [24ms]
• VS Code at C:\Users\nicholdw\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.112.0
[√] Connected device (4 available) [555ms]
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 16 (API 36) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.3260]
• Chrome (web) • chrome • web-javascript • Google Chrome 137.0.7151.104
• Edge (web) • edge • web-javascript • Microsoft Edge 137.0.3296.83
[√] Network resources [481ms]
• All expected network resources are available.
• No issues found!
Подробнее здесь: [url]https://stackoverflow.com/questions/79670801/how-to-fix-the-error-the-named-parameter-settings-isnt-defined-when-invoking[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия