flutter_flipperkit 0.0.3 copy "flutter_flipperkit: ^0.0.3" to clipboard
flutter_flipperkit: ^0.0.3 copied to clipboard

discontinued
outdated

Flipper SDK for Flutter.

flutter_flipperkit #

pub package

English | 简体中文

Introduction #

Flipper SDK for Flutter helps you debug Flutter apps running in an emulator/simulator or connected physical development devices.

Features #

  • Network inspector network

  • Shared preferences (and UserDefaults) inspector shared-preferences

Quick Start #

Prerequisites #

Before starting make sure you have:

Installation #

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

dependencies:
  flutter_flipperkit: ^0.0.3

Change your project ios/Podfile file according to the example:

+source 'https://github.com/facebook/flipper.git'
+source 'https://github.com/CocoaPods/Specs'
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+platform :ios, '9.0'

Change your project android/app/build.gradle file according to the example:

android {
-    compileSdkVersion 27
+    compileSdkVersion 28

    defaultConfig {
-        targetSdkVersion 27
+        targetSdkVersion 28
    }
}

You can install packages from the command line:

$ flutter packages get

Usage #

If you use dio, please see the example

import 'package:flutter_flipperkit/flutter_flipperkit.dart';

void main() {
  FlipperClient flipperClient = FlipperClient.getDefault();

  flipperClient.addPlugin(new FlipperNetworkPlugin());
  flipperClient.addPlugin(new FlipperSharedPreferencesPlugin());
  flipperClient.start();

  Random random = new Random();
  String identifier = '${random.nextInt(9999)}';
  RequestInfo requestInfo = RequestInfo(
    requestId: identifier,
    timeStamp: new DateTime.now().millisecondsSinceEpoch,
    headers: new Map()
      ..putIfAbsent("Content-Type", () => "application/json"),
    method: 'POST',
    uri: 'https://api.example.com/account/login',
    body: new Map()
       ..putIfAbsent("username", () => 'lijy91')
       ..putIfAbsent("password", () => "qDrTBZk8jgbA"),
  );
  ResponseInfo responseInfo = ResponseInfo(
    requestId: identifier,
    timeStamp: new DateTime.now().millisecondsSinceEpoch,
    statusCode: 200,
    headers: new Map()
      ..putIfAbsent("Server", () => "Apache/2.4.1 (Unix)")
      ..putIfAbsent("Content-Type", () => "application/json"),
    body: new Map()
      ..putIfAbsent("code", () => 0)
      ..putIfAbsent("message", () => "login successful"),
  );

  FlipperNetworkPlugin flipperNetworkPlugin = FlipperClient.getDefault().getPlugin(FlipperNetworkPlugin.ID);
  flipperNetworkPlugin.reportRequest(requestInfo);
  flipperNetworkPlugin.reportResponse(responseInfo);

  runApp(MyApp());
}

...

Run the app #

$ flutter run

Known Issues (to note) #

  • [iOS] If you use cocoapods 1.6.0 or later, does not support the use_frameworks!
  • [iOS] Unable to start physical device with flutter run command
  • [Desktop] Chinese characters will be garbled, solved and submitted PR

Discussion #

If you have any suggestions or questions about this project, you can discuss it by Telegram or my wechat.

License #

MIT License

Copyright (c) 2019 JianyingLi <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.