Skip to content

maplibre/flutter-native-interop-playground

installation instructions:

install bazelisk (required for ios builds):

bazelisk

clone maplibre-native with submodules at a specific commit: (TODO: maybe there's a better way to do this?)

git clone https://github.com/maplibre/maplibre-native \
    --filter=blob:none \
    --no-checkout \
    third-party/maplibre-native
cd third-party/maplibre-native
git checkout 29428dce42000484d387ffc7825326faf35c093d
git submodule update --init --recursive --depth 1

clean build artifacts:

  • install cmake
  • Create a new python env with e.g. venv.
./tool/clean_build.py

build the dynamic libraries (by default, builds in RelWithDebInfo):

./tool/build-libraries.py # build everything

./tool/build_libraries.py ios
./tool/build_libraries.py macos
./tool/build_libraries.py android

./tool/build-libraries.py --verbose # see build output

generate style code:

./tool/generate_style.dart

run ffigen:

./tool/ffigen.py

testing only: create a example/lib/keys.dart file and add your style url/api key:

const styleUrl = 'https://api.maptiler.com/maps/streets-v4-dark/style.json?key=x';
const apiKey = 'x';

run the project:

cd example
flutter run

notable folders/files:

lib - Dart code

src - C/C++ code (copied over to third-party/maplibre-native/platform/flutter) during builds

tool - build scripts

ios/flmln/Sources and macos/flmln/Sources - Swift code for texture interfacing with Flutter (NOTE: those two folders are almost exactly the same! i couldn't find a way to share them in a Darwin folder.)

android/src/main - contains some Java code from MapLibre native (some Android stuff uses JNI to use Java objects from C++ code)

About

In-progress work to integrate MapLibre Native and Flutter using Dart Native

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •