Skip to main content

maplibre_native 0.4.0-pre.1 copy "maplibre_native: ^0.4.0-pre.1" to clipboard
maplibre_native: ^0.4.0-pre.1 copied to clipboard

MapLibre Native implementation of the Flutter MapLibre plugin for all non-web platforms, rendering through the MapLibre Native C API.

maplibre_native #

MapLibre Native implementation for maplibre.

It renders through the experimental MapLibre Native C API through its Dart binding maplibre_native_ffi, whose build hook downloads the prebuilt C library, and shows each map as a Flutter Texture.

Platform Rendering
Windows Vulkan into D3D11 textures shared with Flutter, or CPU readback
Android OpenGL ES (default) or Vulkan on the Surface of a Flutter SurfaceProducer
iOS Metal into a texture ring, copied on the GPU into IOSurface pixel buffers
macOS Metal into a texture ring, copied on the GPU into IOSurface pixel buffers
Linux Vulkan into memory imported by OpenGL for Flutter, or CPU readback

Android #

  • Renders with OpenGL ES 3.0 by default, and needs API level 24 or later.

  • To render with Vulkan instead, which needs Vulkan 1.1, select the Vulkan build of the C library for Android in the root pubspec.yaml of the app or workspace:

    hooks:
      user_defines:
        maplibre_native_ffi:
          backend:
            android: vulkan
    

iOS and macOS #

  • Render with Metal, on iOS 15 and macOS 14.3 or later, the minimums of the C library.
  • The plugin is a Swift Package Manager package only, without a podspec. Flutter uses Swift Package Manager by default since 3.44, so apps need no setup for it.
  • The C library is published for iOS devices, arm64 simulators, and Macs (Apple silicon and Intel). iOS apps exclude the x86_64 simulator slice with EXCLUDED_ARCHS, as the example's xcconfigs do.
  • Sandboxed macOS apps need the com.apple.security.network.client entitlement to load styles and tiles.

Linux #

  • Renders with Vulkan 1.1. Frames reach Flutter without a CPU copy when OpenGL has GL_EXT_memory_object_fd and runs on the same GPU and driver as Vulkan, and when Dart runs on the GTK main thread. Otherwise they are read back into a pixel buffer texture.
  • Building needs the GTK and libepoxy development packages (libgtk-3-dev libepoxy-dev on Debian and Ubuntu), and running needs a Vulkan driver.
  • MAPLIBRE_NATIVE_DISABLE_ZERO_COPY=1 forces the CPU readback, on Linux and Windows.

Building the C library locally #

By default the build hook of maplibre_native_ffi downloads the C library of the release it was published with. To use a local build of maplibre-native-ffi instead, name its CMake build root in the root pubspec.yaml. The hook takes <preset>/install under it for each target, so one setting serves every platform and Android ABI you have built:

hooks:
  user_defines:
    maplibre_native_ffi:
      local_build: ../maplibre-native-ffi/build
1
likes
150
points
--
downloads

Documentation

Documentation
API reference

Publisher

verified publisherjoscha-eckert.de

MapLibre Native implementation of the Flutter MapLibre plugin for all non-web platforms, rendering through the MapLibre Native C API.

Homepage
Repository (GitHub)
View/report issues
Contributing

License

BSD-3-Clause, BSD-2-Clause (license)

Dependencies

ffi, flutter, geobase, jni, maplibre_native_ffi, maplibre_platform_interface, path_provider

More

Packages that depend on maplibre_native

Packages that implement maplibre_native