expo_flutter_adapter 0.1.0

  • README.md
  • Example
  • Installing
  • Versions
  • 65

expo_flutter_adapter #

A Flutter adapter for Expo Universal Modules. It requires expo-core to be installed and linked.

Getting Started #

Installation #

Add the plugin as a dependency in your Flutter project's pubspec.yaml file.

  expo_flutter_adapter: ^0.1.0

To install it directly from our git repo, specify the dependency as shown below:

      url: git://github.com/expo/expo.git
      path: packages/expo-flutter-adapter

Configuration #

In your Android app's MainActivity.java file:

  1. Import the adapter's java package by adding import io.expo.expoflutteradapter.ExpoFlutterAdapterPlugin; to your imports section.

  2. Add a call to ExpoFlutterAdapterPlugin's initialize method after the GeneratedPluginRegistrant.registerWith(this); call by adding ExpoFlutterAdapterPlugin.initialize(); after it.

Usage #

If you're simply adding this to consume other previously developed Flutter Universal Module plugins, you won't have to read past this point.

If you're developing a Universal Module Flutter plugin, you are probably interested in the ExpoModulesProxy for interfacing with native Universal Modules from Dart.

You can import the module proxy by adding this line to the beginning of your dart file:

import 'package:expo_flutter_adapter/expo_modules_proxy.dart';

This file contains two classes: ExpoModulesProxy and ExpoEvent.

ExpoModulesProxy #

The Dart API of the ExpoModuleProxy is as follows:

static Future<dynamic> callMethod(String moduleName, String methodName, [List<dynamic> arguments = const []])

ExpoModuleProxy.callMethod is a static method that your plugin can use to call a method exposed by the specified Universal Module. The parameter names should be pretty self-explanatory.

static Future<dynamic> getConstant(String moduleName, String constantName)

ExpoModuleProxy.getConstant is a static method that your plugin can use to retrieve a constant exposed by the specified Universal Module.

static Stream<ExpoEvent> get events

ExpoModuleProxy.events is a stream of all events being emitted by the Universal Module core. As a plugin developer, you can filter by event names to expose module-specific events to your consumers. See accelerometer.dart from the expo_sensors package for an example.

ExpoEvent #

ExpoEvent is a data class streamed from ExpoModuleProxy.events that has the following properties:

expoEvent.name (String): the name of the incoming event.

expoEvent.body (Map<String, dynamic>): the payload of the incoming event.

Pro Tip: See other Universal Module Flutter plugins in the packages directory of this repository for more examples of how this adapter is used.

0.1.0 #

  • This initial release allows Unimodule Flutter plugin developers to call exported methods from unimodules, register new modules on the Android platform, get constants from unimodules, and access the stream of events that are being emitted by the registered modules.


test_suite_flutter #

A Test Suite for Expo Modules on Flutter.

Getting Started #

  • Grab the universal modules themselves (currently distributed as NPM packages) by running yarn in this directory.

  • Assuming Flutter is already installed, use your IDE of choice to run the app or use flutter run at the command-line with a device attached to build, install, and launch the app on your device.

Note: if you see an error on the iOS side about CocoaPods complaining about a pre-release version of the unimodule it's trying to link, run pod update in the example/ios folder. That should resolve your issue.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  expo_flutter_adapter: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:expo_flutter_adapter/expo_flutter_adapter.dart';
Version Uploaded Documentation Archive
0.1.0 Feb 17, 2019 Go to the documentation of expo_flutter_adapter 0.1.0 Download expo_flutter_adapter 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
expo_permissions ^0.1.0
expo_sensors ^0.1.0