flutter_boost_androidx 0.0.421

  • Readme
  • Changelog
  • Example
  • Installing
  • 62

中文文档 中文介绍

FlutterBoost #

A next-generation Flutter-Native hybrid solution. FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts.The philosophy of FlutterBoost is to use Flutter as easy as using a WebView. Managing Native pages and Flutter pages at the same time is non-trivial in an existing App. FlutterBoost takes care of page resolution for you. The only thing you need to care about is the name of the page(usually could be an URL). 

Prerequisites #

You need to add Flutter to your project before moving on.

Getting Started #

Add a dependency in you Flutter project. #

Open you pubspec.yaml and add the following line to dependencies:

flutter_boost: ^0.0.415

or you could rely directly on a Github project tag, for example(recommended)

            url: 'https://github.com/alibaba/flutter_boost.git'
            ref: '0.0.415'

Integration with Flutter code. #

Add init code to you App

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  void initState() {

    ///register page widget builders,the key is pageName
      'sample://firstPage': (pageName, params, _) => FirstRouteWidget(),
      'sample://secondPage': (pageName, params, _) => SecondRouteWidget(),

    ///query current top page and load it

  Widget build(BuildContext context) => MaterialApp(
      title: 'Flutter Boost example',
      builder: FlutterBoost.init(), ///init container manager
      home: Container());

Integration with iOS code. #

Note: You need to add libc++ into "Linked Frameworks and Libraries"

Use FLBFlutterAppDelegate as the superclass of your AppDelegate

@interface AppDelegate : FLBFlutterAppDelegate <UIApplicationDelegate>

Implement FLBPlatform protocol methods for your App.

@interface DemoRouter : NSObject<FLBPlatform>

@property (nonatomic,strong) UINavigationController *navigationController;

+ (DemoRouter *)sharedRouter;


@implementation DemoRouter

- (void)openPage:(NSString *)name
          params:(NSDictionary *)params
      completion:(void (^)(BOOL))completion
    if([params[@"present"] boolValue]){
        FLBFlutterViewContainer *vc = FLBFlutterViewContainer.new;
        [vc setName:name params:params];
        [self.navigationController presentViewController:vc animated:animated completion:^{}];
        FLBFlutterViewContainer *vc = FLBFlutterViewContainer.new;
        [vc setName:name params:params];
        [self.navigationController pushViewController:vc animated:animated];

- (void)closePage:(NSString *)uid animated:(BOOL)animated params:(NSDictionary *)params completion:(void (^)(BOOL))completion
    FLBFlutterViewContainer *vc = (id)self.navigationController.presentedViewController;
    if([vc isKindOfClass:FLBFlutterViewContainer.class] && [vc.uniqueIDString isEqual: uid]){
        [vc dismissViewControllerAnimated:animated completion:^{}];
        [self.navigationController popViewControllerAnimated:animated];


Initialize FlutterBoost with FLBPlatform at the beginning of your App.

 [FlutterBoostPlugin.sharedInstance startFlutterWithPlatform:router
                                                        onStart:^(FlutterViewController *fvc) {

Integration with Android code. #

Init FlutterBoost in Application.onCreate() 

public class MyApplication extends FlutterApplication {
    public void onCreate() {
        FlutterBoostPlugin.init(new IPlatform() {
            public Application getApplication() {
                return MyApplication.this;

             * get the main activity, this activity should always at the bottom of task stack.
            public Activity getMainActivity() {
                return MainActivity.sRef.get();

            public boolean isDebug() {
                return false;

             * start a new activity from flutter page, you may need a activity router.
            public boolean startActivity(Context context, String url, int requestCode) {
                return PageRouter.openPageByUrl(context,url,requestCode);

            public Map getSettings() {
                return null;

Basic Usage #

Concepts #

All page routing requests are being sent to the native router. Native router communicates with Native Container Manager, Native Container Manager takes care of building and destroying of Native Containers. 

Use Flutter Boost Native Container to show a Flutter page in native code. #


 FLBFlutterViewContainer *vc = FLBFlutterViewContainer.new;
        [vc setName:name params:params];
        [self.navigationController presentViewController:vc animated:animated completion:^{}];


public class FlutterPageActivity extends BoostFlutterActivity {

    public void onRegisterPlugins(PluginRegistry registry) {
        //register flutter plugins

    public String getContainerName() {
        //specify the page name register in FlutterBoost
        return "sample://firstPage";

    public Map getContainerParams() {
        //params of the page
        Map<String,String> params = new HashMap<>();
        return params;


public class FlutterFragment extends BoostFlutterFragment {
    public void onRegisterPlugins(PluginRegistry registry) {

    public String getContainerName() {
        return "sample://firstPage";

    public Map getContainerParams() {
        Map<String,String> params = new HashMap<>();
        return params;

Use Flutter Boost to open a page in dart code. #


 FlutterBoost.singleton.openPage("pagename", {}, true);

Use Flutter Boost to close a page in dart code. #


Running the Demo #

Please see the example for details.

License #

This project is licensed under the MIT License - see the LICENSE.md file for details

关于我们 #




架构/服务端/客户端/前端/算法/质量工程师 在公众号中投递简历,名额不限哦



For English

0.0.421 #

  • TODO: Describe initial release. flutter_boost_androidx androidx base by 0.0.420,

dependencies androidx xservice_kit_androidx ^0.0.30,

sdk by 28.0.0.

The name change flutter_boost replace by flutter_boost_androidx;

xservice_kit replace by flutter_boost_androidx;


flutter_boost_example #

Demonstrates how to use the flutter_boost plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

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

  flutter_boost_androidx: ^0.0.421

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_canPop.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_didDisappearPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_didInitPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_didShowPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_onNativePageResult.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_willDeallocPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_willDisappearPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/handlers/NavigationService_willShowPageContainer.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/service/NavigationService.dart';
import 'package:flutter_boost_androidx/AIOService/NavigationService/service/NavigationServiceRegister.dart';
import 'package:flutter_boost_androidx/AIOService/loader/ServiceLoader.dart';
import 'package:flutter_boost_androidx/container/boost_container.dart';
import 'package:flutter_boost_androidx/container/container_coordinator.dart';
import 'package:flutter_boost_androidx/container/container_manager.dart';
import 'package:flutter_boost_androidx/container/navigator_observer.dart';
import 'package:flutter_boost_androidx/flutter_boost.dart';
import 'package:flutter_boost_androidx/generated/i18n.dart';
import 'package:flutter_boost_androidx/messaging/message_proxy.dart';
import 'package:flutter_boost_androidx/messaging/native_page_container_event_handler.dart';
import 'package:flutter_boost_androidx/messaging/page_result_mediator.dart';
import 'package:flutter_boost_androidx/observers_holders.dart';
import 'package:flutter_boost_androidx/router/boost_page_route.dart';
import 'package:flutter_boost_androidx/router/router.dart';
import 'package:flutter_boost_androidx/support/Tracer.dart';
import 'package:flutter_boost_androidx/support/logger.dart';
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 Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/container/boost_container.dart. (-1.49 points)

Analysis of lib/container/boost_container.dart reported 3 hints:

line 25 col 8: Unused import: 'package:flutter_boost_androidx/container/container_coordinator.dart'.

line 202 col 3: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 209 col 5: The class 'Future' wasn't exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

Fix lib/AIOService/NavigationService/service/NavigationService.dart. (-1 points)

Analysis of lib/AIOService/NavigationService/service/NavigationService.dart reported 2 hints:

line 40 col 22: 'listenEvent' is deprecated and shouldn't be used.

line 44 col 16: 'cancelEventForSubscription' is deprecated and shouldn't be used.

Fix lib/AIOService/NavigationService/handlers/NavigationService_canPop.dart. (-0.50 points)

Analysis of lib/AIOService/NavigationService/handlers/NavigationService_canPop.dart reported 1 hint:

line 9 col 7: Name types using UpperCamelCase.

Fix additional 19 files with analysis or formatting issues. (-5 points)

Additional issues in the following files:

  • lib/AIOService/NavigationService/handlers/NavigationService_didDisappearPageContainer.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_didInitPageContainer.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_didShowPageContainer.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_onNativePageResult.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_willDeallocPageContainer.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_willDisappearPageContainer.dart (1 hint)
  • lib/AIOService/NavigationService/handlers/NavigationService_willShowPageContainer.dart (1 hint)
  • lib/container/container_coordinator.dart (1 hint)
  • lib/flutter_boost.dart (1 hint)
  • lib/router/router.dart (1 hint)
  • lib/AIOService/NavigationService/service/NavigationServiceRegister.dart (Run flutter format to format lib/AIOService/NavigationService/service/NavigationServiceRegister.dart.)
  • lib/AIOService/loader/ServiceLoader.dart (Run flutter format to format lib/AIOService/loader/ServiceLoader.dart.)
  • lib/container/container_manager.dart (Run flutter format to format lib/container/container_manager.dart.)
  • lib/container/navigator_observer.dart (Run flutter format to format lib/container/navigator_observer.dart.)
  • lib/generated/i18n.dart (Run flutter format to format lib/generated/i18n.dart.)
  • lib/messaging/message_proxy.dart (Run flutter format to format lib/messaging/message_proxy.dart.)
  • lib/messaging/native_page_container_event_handler.dart (Run flutter format to format lib/messaging/native_page_container_event_handler.dart.)
  • lib/messaging/page_result_mediator.dart (Run flutter format to format lib/messaging/page_result_mediator.dart.)
  • lib/support/logger.dart (Run flutter format to format lib/support/logger.dart.)

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
xservice_kit_androidx ^0.0.30 0.0.30
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8