RxDart:创建主题时出现异常

时间:2018-03-18 22:13:58

标签: dart flutter reactivex dart-async

我正在使用RxDart在我的Flutter应用程序中添加async:dart的功能。

我看到了这个例外:

I/FlutterActivityDelegate( 5299): onResume setting current activity to this
E/flutter ( 5299): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 5299): 'dart:async/stream.dart': error: line 942: signature type '(TypeToken) => Observable' of function 'cast' is not a subtype of signature type '() => Stream' of function 'cast'
E/flutter ( 5299): 
E/flutter ( 5299):   Stream < R > cast < R >() {
E/flutter ( 5299):   ^
E/flutter ( 5299): 'package:rxdart/src/observable.dart': error: line 1156: class 'Observable' overrides method 'cast' of super class or interface 'Stream' with incompatible parameters
E/flutter ( 5299):   Observable < S > cast < S >(TypeToken < S > typeToken) =>
E/flutter ( 5299):   ^
E/flutter ( 5299): 
E/flutter ( 5299): #0      new MobileAuthentication (package:lib.frontend.apps.mobile.authentication/src/authentication/authenticator/mobile_authentication.dart:14)
E/flutter ( 5299): #1      MobileContext.setupProduction (file:///Users/marc/BasicWindow/source/monorepo/dart/projects/nightpal/mobile/lib/src/app/context.dart:9)
E/flutter ( 5299): #2      ContextBase.setup (package:nightpal.shared/src/app/context.dart:33)
E/flutter ( 5299): #3      main (file:///Users/marc/BasicWindow/source/monorepo/dart/projects/nightpal/mobile/lib/main.dart:7)
E/flutter ( 5299): #4      _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:279)
E/flutter ( 5299): #5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
I/FlutterActivityDelegate( 5299): onResume setting current activity to this

我在课堂上创建这样的主题:

class _State extends AuthenticationStateBase<SignInPage> implements ISignInView {

  final PublishSubject _onSignIn = new PublishSubject();
  @override Observable<SignInEvent> get onSignIn => _onSignIn.observable;

  _State(IController<IView> controller) : super(controller);
  //...
}

错误中的第14行是我创建PublishSubject

的地方

在我的pubspec.yaml我有依赖rxdart: ^0.15.0

0 个答案:

没有答案