maplibre_gl 0.24.0 copy "maplibre_gl: ^0.24.0" to clipboard
maplibre_gl: ^0.24.0 copied to clipboard

A Flutter plugin for integrating MapLibre Maps inside a Flutter application on Android, iOS and web platforms.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart';

void main() {
  runApp(const _ExampleApp());
}

class _ExampleApp extends StatelessWidget {
  const _ExampleApp();

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: _ExampleHomePage(),
    );
  }
}

class _ExampleHomePage extends StatefulWidget {
  const _ExampleHomePage();

  @override
  State<_ExampleHomePage> createState() => _ExampleHomePageState();
}

class _ExampleHomePageState extends State<_ExampleHomePage> {
  MapLibreMapController? _controller;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('maplibre_gl minimal example')),
      body: MapLibreMap(
        // ignore: avoid_redundant_argument_values --- EXAMPLE ---
        styleString: 'https://demotiles.maplibre.org/style.json',
        onMapCreated: (c) => _controller = c,
        initialCameraPosition: const CameraPosition(
          target: LatLng(0, 0),
          zoom: 1.0,
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          final c = _controller;
          if (c == null) return;
          await c.animateCamera(
            CameraUpdate.newCameraPosition(
              const CameraPosition(target: LatLng(0, 0), zoom: 3),
            ),
          );
        },
        child: const Icon(Icons.flight),
      ),
    );
  }
}
77
likes
160
points
19.1k
downloads

Publisher

verified publishermaplibre.org

Weekly Downloads

A Flutter plugin for integrating MapLibre Maps inside a Flutter application on Android, iOS and web platforms.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, maplibre_gl_platform_interface, maplibre_gl_web

More

Packages that depend on maplibre_gl

Packages that implement maplibre_gl