搜索
componentsHigh German map 搜索
component. Dart interface is generated based on Fluttify engine. Interface document .
I undertake outsourcing projects (map apps are preferred), please contact qq 382146139 if you are interested.
installation:
dependencies:
flutter:
sdk: flutter
amap_search_fluttify: ^x.x.x
Import:
import 'package:amap_search_fluttify/amap_search_fluttify.dart';
use:
///! Note: As long as it is a method that returns Future, it is always decorated with `await` to ensure that the next line is executed after the current method is completed. In the environment where `await` cannot be used , execute it in the `then` method One step.
/// Initializing iOS is set in the init method, android needs to be set in AndroidManifest.xml, see https://lbs.amap.com/api/android-sdk/gettingstarted
await AmapCore.init('ios key');
///! Important: Release the objects on the native side through AmapSearchDisposeMixin, otherwise the native side will leak memory!
class _KeywordPoiScreenState extends State<KeywordPoiScreen> with AmapSearchDisposeMixin {}
/// Search keyword poi
final poiList = await AmapSearch .instance. searchKeyword (
_keywordController.text,
city: _cityController.text,
);
/// Search surrounding poi
final poiList = await AmapSearch.instance.searchAround(
LatLng(
double.tryParse(_latController.text) ?? 29.08,
double.tryParse(_lngController.text) ?? 119.65,
),
keyword: _keywordController.text,
);
/// Input prompt
final inputTipList = await AmapSearch.instance.fetchInputTips(
_keywordController.text,
city: _cityController.text,
);
/// Geocoding (address to coordinates)
final geocodeList = await AmapSearch.instance.searchGeocode(
_keywordController.text,
city: _cityController.text,
);
/// Reverse geocoding (coordinate to address)
final reGeocodeList = await AmapSearch.instance.searchReGeocode(
LatLng(
double.parse(_latController.text),
double.parse(_lngController.text),
),
radius: 200.0,
);
/// Get administrative division data
final district = await AmapSearch.instance.searchDistrict(_keywordController.text);
/// Get weather data
final district = await AmapSearch.instance.searchDistrict(_keywordController.text);
/// Bus route planning (unfinished)
final routeResult = await AmapSearch.instance.searchBusRoute(
from: LatLng(
double.parse(_fromLatController.text),
double.parse(_fromLngController.text),
),
to: LatLng(
double.parse(_toLatController.text),
double.parse(_toLngController.text),
),
city : 'Hangzhou' ,
);
/// Driving path planning
final routeResult = await AmapSearch.instance.searchDriveRoute(
from: LatLng(
double.parse(_fromLatController.text),
double.parse(_fromLngController.text),
),
to: LatLng(
double.parse(_toLatController.text),
double.parse(_toLngController.text),
),
);
/// Cycling path planning
final routeResult = await AmapSearch.instance.searchRideRoute(
from: LatLng(
double.parse(_fromLatController.text),
double.parse(_fromLngController.text),
),
to: LatLng(
double.parse(_toLatController.text),
double.parse(_toLngController.text),
),
);
/// Walking path planning
final routeResult = await AmapSearch.instance.searchWalkRoute(
from: LatLng(
double.parse(_fromLatController.text),
double.parse(_fromLngController.text),
),
to: LatLng(
double.parse(_toLatController.text),
double.parse(_toLngController.text),
),
);
Author: fluttify-project
Source Code: https://github.com/fluttify-project/amap_search_fluttify
#flutter #dart #mobile-apps