location_picker library
Location picker module for the neshan_maps_flutter package.
This module provides location picking functionality including:
- Location picker widget (NeshanLocationPicker)
- Location picker configuration (NeshanLocationPickerConfig)
- Map configuration (NeshanMapConfig) for configuring the underlying map
- Reverse geocoding models (ReverseGeocodingResponse)
- API error handling (NeshanApiError)
- Error callbacks on the map and picker widgets
Note: This library re-exports NeshanMapConfig and NeshanMapType for
configuring the picker’s map. For NeshanMap, NeshanMapController, and
NeshanMarker, import package:neshan_maps_flutter/map.dart.
Usage
import 'package:neshan_maps_flutter/location_picker.dart';
import 'package:latlong2/latlong.dart';
NeshanLocationPicker(
mapKey: 'your-map-api-key',
reverseGeocodingApiKey: 'your-reverse-geocoding-key',
mapConfig: NeshanMapConfig(
initialCenter: LatLng(35.6892, 51.3890),
),
onLocationAccepted: (position, address) {
print('Selected: $address at ${position.latitude}, ${position.longitude}');
},
);
Classes
- AcceptButtonData
- Data provided to AcceptButtonBuilder.
- AddressDisplayData
- Data provided to AddressDisplayBuilder.
- ApiServiceError
- API service configuration error (HTTP 483, 484, 485).
- CoordinateParseError
- Invalid coordinate parameters error (HTTP 470).
- InvalidApiKeyError
- Invalid or missing API key error (HTTP 480).
- InvalidArgumentError
- Invalid request parameters error (HTTP 400).
- NeshanApiError
- Base sealed class for all Neshan API errors.
- NeshanLocationPicker
- A location picker widget that wraps NeshanMap with reverse-geocoding and search features.
- NeshanLocationPickerConfig
- Configuration for timing and behavior settings of the Neshan Location Picker.
- NeshanLocationPickerUiConfig
- UI configuration for NeshanLocationPicker.
- NeshanMapConfig
- Viewport and style configuration for initializing a NeshanMap.
- NetworkError
- Network-related error (connection failed, timeout, etc.).
- NotFoundError
- Location not found error (HTTP 404).
- ParseError
- Response parsing error.
- RateLimitExceededError
- Rate limit exceeded error (HTTP 481, 482).
- ReverseGeocodingResponse
- Response model for Neshan reverse-geocoding API.
- UnknownError
- Unknown or unexpected error (HTTP 500 or unhandled status codes).
Enums
- NeshanMapType
- Enum representing the different types of Neshan maps available.
Typedefs
- AcceptButtonBuilder = Widget Function(BuildContext context, AcceptButtonData data)
- Builder function for customizing the accept button widget.
- AddressDisplayBuilder = Widget Function(BuildContext context, AddressDisplayData data)
- Builder function for customizing the address display widget.
- CenterMarkerBuilder = Widget Function(BuildContext context)
- Builder function for customizing the center marker.