go_login_handler.dart 476 Bytes
import 'package:appframe/bloc/web_cubit.dart';
import 'package:appframe/services/dispatcher.dart';

class GoLoginHandler extends MessageHandler {
  late WebCubit? _webCubit;

  @override
  void setCubit(WebCubit cubit) {
    this._webCubit = cubit;
  }

  void _unfollowCubit() {
    this._webCubit = null;
  }

  @override
  Future<dynamic> handleMessage(params) async {
    try {
      _webCubit!.goLogin();
      return;
    } finally {
      _unfollowCubit();
    }
  }
}