flib_event_bus 1.0.0

About #

一个用来管理事件通信的库,支持观察者监听生命周期,当生命周期销毁后自动移除观察者

Install #

  • git
  flib_event_bus:
    git:
      url: git://github.com/zj565061763/flib_event_bus
      ref: 1.0.0
  • pub
  dependencies:
    flib_event_bus: ^1.0.0

Example #

// 发送事件
FEventBus.singleton.post(ELoginSuccess());

// 监听事件
FEventBus.singleton.addObserver<ELoginSuccess>((event) {}, this);
/// 发送事件
///
/// - [event] 要发送的事件
void post(dynamic event)
/// 添加观察者
///
/// - [T] 需要观察的事件类型
/// - [observer] 观察者
/// - [lifecycleOwner] 观察者要绑定的生命周期
///   1. [lifecycleOwner] != null,则[FLifecycleEvent.onDestroy]事件后,会自动移除观察者
///   2. [lifecycleOwner] == null,则不会自动移除观察者
void addObserver<T>(FEventBusObserver<T> observer, FLifecycleOwner lifecycleOwner)

1.0.0 #

release date: 2019.05.16

Use this package as a library

1. Depend on it

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


dependencies:
  flib_event_bus: ^1.0.0

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:flib_event_bus/flib_event_bus.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
33
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flib_event_bus.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flib_lifecycle ^1.0.0 1.0.0
flutter 0.0.0
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
Dev dependencies
flutter_test