Line data Source code
1 : import 'dart:async'; 2 : 3 : class GlobalErrorBus { 4 6 : static final _controller = StreamController<AppError>.broadcast(); 5 : 6 6 : static Stream<AppError> get stream => _controller.stream; 7 : 8 2 : static void dispatch(AppError error) { 9 4 : _controller.add(error); 10 : } 11 : } 12 : 13 : class AppError { 14 : final String type; 15 : final String message; 16 2 : AppError(this.type, this.message); 17 : }