Integration with an existing android activity or existing Dart package

115 views
Skip to first unread message

j...@nella.org

unread,
Nov 7, 2015, 5:13:05 AM11/7/15
to Flutter Dev
I've read that a Flutter activity can be inside of an existing Android app. I'd like to use an existing Android activity (OSMDroid's mapview) inside of a Flutter app. I understand that I'd lose iOS compatibility in that case, but I'll deal with that later... :)

Alternatively, I would like to understand how to adapt an existing dart package, like package:google_maps/google_maps.dart so that it can work in Flutter. Where could I find some example code to read?

Sorry if these are all patently impossible and I'm barking up the wrong tree. Am new here... :)

  -jeff

Adam Barth

unread,
Nov 7, 2015, 1:07:58 PM11/7/15
to Jeff R. Allen, Flutter Dev
On Sat, Nov 7, 2015 at 2:13 AM, <j...@nella.org> wrote:
I've read that a Flutter activity can be inside of an existing Android app. I'd like to use an existing Android activity (OSMDroid's mapview) inside of a Flutter app. I understand that I'd lose iOS compatibility in that case, but I'll deal with that later... :)

We've mostly been focusing on the case where the whole app is built using Flutter, which means we haven't created an end-developer workflow for hybrid apps yet.  Getting this working today will involve building the engine from source and poking around a bit to see how the shell is put together.

Our intent is to factor a FlutterView subclass of android.view.View out of the shell and have the shell just be a simple FlutterView consumer.  Once we do that, it will be easier to create hybrid apps that also consume FlutterView.  If you're interested in doing some of this refactoring, I can help you get started.

Alternatively, I would like to understand how to adapt an existing dart package, like package:google_maps/google_maps.dart so that it can work in Flutter. Where could I find some example code to read?

The google_maps package has a dependency on dart:html, which isn't available inside Flutter.  If you want to show a map in your app, the shortest path is to use the static maps API: https://developers.google.com/maps/documentation/static-maps/intro?hl=en.  Full support for maps is https://github.com/flutter/engine/issues/30

Sorry if these are all patently impossible and I'm barking up the wrong tree. Am new here... :)

They're definitely not impossible.  There's just some work to do.  :)

Adam

Reply all
Reply to author
Forward
0 new messages