PolylinePoints class

Enhanced PolylinePoints class supporting both legacy Directions API and new Routes API Provides backward compatibility while enabling access to advanced routing features

Constructors

PolylinePoints({required String apiKey, Duration defaultTimeout = const Duration(seconds: 30), bool preferRoutesApi = true})
Create a new PolylinePointsV2 instance
PolylinePoints.custom({required String apiKey, Duration? timeout, bool? preferRoutesApi})
Create instance with custom configuration
factory
PolylinePoints.enhanced(String apiKey)
Create instance optimized for Routes API usage
factory
PolylinePoints.legacy(String apiKey)
Create instance optimized for legacy API usage
factory

Properties

apiKey → String
Google API key for accessing routing services
final
defaultTimeout → Duration
Default timeout for API requests
final
hashCode → int
The hash code for this object.
no setterinherited
preferRoutesApi → bool
Whether to prefer Routes API over Directions API when both are available
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

canConvertToLegacy(RoutesApiRequest request) → bool
Check if a Routes API request can be converted to legacy format
checkApiAvailability() → Future<Map<String, bool>>
Check which APIs are available with the current API key
convertToLegacyResult(RoutesApiResponse response) → PolylineResult
Convert Routes API response to legacy PolylineResult format
getApiRecommendation(PolylineRequest request) → String
Get API usage recommendation for a given request
getConversionBlockerReason(RoutesApiRequest request) → String?
Get reason why a Routes API request cannot be converted to legacy format
getRouteBetweenCoordinates({required PolylineRequest request, Duration? timeout}) → Future<PolylineResult>
Get route between coordinates using legacy Directions API
getRouteBetweenCoordinatesV2({required RoutesApiRequest request, Duration? timeout}) → Future<RoutesApiResponse>
Get route using the new Routes API with enhanced features
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

decodePolyline(String encodedString) → List<PointLatLng>
Decode and encoded google polyline e.g "_piFps|U_ulLnnqC_mqNvxq`@"