Flutter调试工具 flutter_flipperkit 插

2019-10-17  本文已影响0人  StevenHu_Sir

1.引入依赖

# Flutter 调试工具
  flutter_flipperkit:
    git:
      url: https://github.com/blankapp/flutter_flipperkit
      ref: stable

2.android/app/build.gradle 配置

android {
compileSdkVersion 28
    defaultConfig {
      targetSdkVersion 28
    }
}

3.android/app/gradle.properties

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true

4.android/settings.gradle

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
    if (name == 'flutter_flipperkit') {
        include ':flipper-no-op'
        project(':flipper-no-op').projectDir = new File(pluginDirectory, 'flipper-no-op')
    }
}

5.接入项目

void main() {

  // 插件初始化
  config();

  runApp(MyApp());
}

/// 插件初始化
void config() async {

  /// flutter debug
  FlipperClient flipperClient = FlipperClient.getDefault();
  flipperClient.addPlugin(new FlipperNetworkPlugin());
  flipperClient.addPlugin(new FlipperSharedPreferencesPlugin());
  flipperClient.start();

}
上一篇下一篇

猜你喜欢

热点阅读