central_map 0.1.0
central_map: ^0.1.0 copied to clipboard
Kyrgyzstan map for Flutter — a MapLibre widget over central.kg vector tiles with markers, polylines and clusters, plus a REST client for search, routing and isochrones.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:central_map/central_map.dart';
// Key from auth.central.kg (account -> API keys), bound to the map service.
const apiKey = String.fromEnvironment(
'CENTRAL_MAP_KEY'); // --dart-define=CENTRAL_MAP_KEY=...
void main() => runApp(const DemoApp());
class DemoApp extends StatelessWidget {
const DemoApp({super.key});
@override
Widget build(BuildContext context) {
final config = CentralMapConfig(apiKey: apiKey.isEmpty ? null : apiKey);
return MaterialApp(
title: 'central_map demo',
theme: ThemeData.dark(),
home: Scaffold(
appBar: AppBar(title: const Text('central.kg map')),
body: CentralMap(
config: config,
dark: true,
initialCenter: const LatLng(42.86, 74.9),
initialZoom: 9,
onReady: (c) async {
// markers
await c.addMarker(const LatLng(42.87, 74.59),
color: const Color(0xFF22D3EE)); // Bishkek
await c.addMarker(const LatLng(42.89, 74.85),
color: const Color(0xFF34D399)); // Kant
await c.addMarker(const LatLng(42.84, 75.29),
color: const Color(0xFFA855F7)); // Tokmok
// polyline
await c.addPolyline(
const [
LatLng(42.87, 74.59),
LatLng(42.89, 74.85),
LatLng(42.84, 75.29)
],
color: const Color(0xFF6366F1),
width: 4,
);
// search over the REST API
final api = CentralMapApi(config);
final hits = await api.search('Ала-Тоо', limit: 5);
debugPrint(
'found ${hits.length}: ${hits.map((h) => h.name).toList()}');
},
),
),
);
}
}