FLUTTER ECOSYSTEM

andrea689/flutter_bloc_devtools

用於 flutter_bloc 的遠端 DevTools。此套件將所有 Bloc(不支援 Cubit)連接到遠端 DevTools 伺服器,讓開發者能在執行時檢查 Bloc 的變更。

flutter_bloc_devtools 專案封面
Stars
70
Forks
15
最近推送(UTC)
2021年12月30日
專案狀態
未封存
Andrea Valenzano GitHub avatar
GITHUB User

Andrea Valenzano ↗

Software Engineer @ 3Bee - Flutter enthusiast

Catania
語言DartRubySwiftKotlinObjective-C

此儲存庫發佈的套件

使用的依賴

依賴清單 3 項
  • bloc^6.1.0
  • socketcluster_client^0.2.0
  • pedantic開發依賴^1.9.0

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

Remote Devtools for flutter_bloc

Remote Devtools support for Blocs of flutter_bloc.

N.B. Cubit is not supported

Devtools Demo

Installation

Add the library to pubspec.yaml:

dependencies:
  flutter_bloc_devtools: ^0.1.0

BlocObserver configuration

Add RemoteDevToolsObserver to your Bloc.observer:

void main() async {
  final observer = RemoteDevToolsObserver('192.168.1.7:8000');
  await observer.connect();
  Bloc.observer = observer;

  runApp(const CounterApp());
}

Making your Events and States Mappable

Events and States have to implements Mappable:

class CounterState extends Equatable implements Mappable {
  final int counter;

  const CounterState({
    this.counter,
  });

  @override
  List<Object> get props => [
        counter,
      ];

  @override
  Map<String, dynamic> toMap() => {
        'counter': counter,
      };
}

Using remotedev

Use the Javascript Remote Devtools package. Start the remotedev server on your machine

npm install -g remotedev-server
remotedev --port 8000

Run your application. It will connect to the remotedev server. You can now debug your flutter_bloc application by opening up http://localhost:8000 in a web browser.

Examples