import 'package:event_bus/event_bus.dart';



//订阅者回调签名
typedef EventCallback = void Function(dynamic arg);

///事件总线
class EventBusUtils {
  late final EventBus _eventBus;

  // 单例模式
  static final EventBusUtils _instance = EventBusUtils._internal();
  factory EventBusUtils() => _instance;
  EventBusUtils._internal() {
     _eventBus = EventBus();
  }

  // 获取实例
  EventBus getEventBus(){
    return _eventBus;
  }

  // 发起事件
  void toFire<T>(T model){
    _eventBus.fire(model);
  }
}

