Флаттер-флэпперкит
Содержание сгенерировано с помощью DocToc
Флэппер (расширяемый отладчик мобильных приложений) для флаттера. Просмотр документа.
Перед началом убедитесь, что у вас есть:
Добавьте это в файл pubspec.yaml вашего пакета:
dependencies:
flutter_flipperkit: ^0.0.29
Или
dependencies:
flutter_flipperkit:
git:
url: https://github.com/leanflutter/flutter_flipperkit
ref: main
Измените файлы проекта в соответствии с примером:
android/settings.gradle
:
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
+ def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+ def plugins = new Properties()
+ def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
+ assert pluginsFile.exists()
+ pluginsFile.withReader("UTF-8") { reader -> plugins.load(reader) }
+ plugins.each { name, path ->
+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
+ if (name == 'flutter_flipperkit') {
+ include ':flipper-no-op'
+ project(':flipper-no-op').projectDir = new File(pluginDirectory, 'flipper-no-op')
+ }
+ }
Откройте
ios/Runner.xcworkspace
, добавьте пустой файл Swift (например,Runner-Noop.swift
) в группуRunner
и убедитесь, что файлRunner-Bridging-Header.h
создан.
Измените файл проекта ios/Podfile
в соответствии с примером:
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do **flutter_install_all_ios_pods**
File.dirname(File.realpath(FILE)) end
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end
**Использование**
```dart
import 'package:flutter_flipperkit/flutter_flipperkit.dart';
void main() {
FlipperClient flipperClient = FlipperClient.getDefault();
flipperClient.addPlugin(new FlipperNetworkPlugin(
// Если вы используете библиотеку http, вы должны установить для неё значение false и использовать https://pub.dev/packages/flipperkit_http_interceptor
// useHttpOverrides: false,
// Необязательно, для фильтрации запроса
filter: (HttpClientRequest request) {
String url = '${request.uri}';
if (url.startsWith('https://via.placeholder.com') || url.startsWith('https://gravatar.com')) {
return false;
}
return true;
}
));
flipperClient.addPlugin(new FlipperReduxInspectorPlugin());
flipperClient.addPlugin(new FlipperSharedPreferencesPlugin());
flipperClient.start();
runApp(MyApp());
}
...
Пожалуйста, обратитесь к примерам, чтобы интегрировать flutter_flipperkit в свой проект.
Вы можете установить пакеты из командной строки:
$ flutter clean
$ flutter packages get
$ flutter run
Если у вас есть какие-либо предложения или вопросы по этому проекту, вы можете обсудить это со мной в Telegram Group.
MIT License
Copyright (c) 2019-2023 LiJianying <lijy91@foxmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Комментарии ( 0 )