formatOlaMapError function

String formatOlaMapError(
  1. Object error
)

Implementation

String formatOlaMapError(Object error) {
  final raw = error is PlatformException
      ? (error.message ?? error.code)
      : error.toString();
  if (raw.contains('403')) {
    return 'Ola Maps rejected the style request (HTTP 403). '
        'Use a real API key from https://maps.olakrutrim.com/ and run:\n'
        'flutter run --dart-define=OLA_MAPS_API_KEY=YOUR_KEY';
  }
  if (raw.contains('401')) {
    return 'Ola Maps authentication failed (HTTP 401). Check the API key.';
  }
  return raw;
}