我正在尝试将Flutter应用迁移到网络中。 这段代码适用于应用程序。
FirebaseAuth.instance.onAuthStateChanged.listen((firebaseUser) {
setState(() {
user = firebaseUser;
});
});
但是当我flutter run -d chrome
时。在webview上运行它,出现错误:
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following JSNoSuchMethodError was thrown building Builder:
NoSuchMethodError: invalid member on null: 'onAuthStateChanged'
The relevant error-causing widget was:
MaterialApp org-dartlang-app:///packages/app/home_app.dart:66:16
我当前正在使用firebase_auth: 0.15.3+1
并使用此配置
firebase_auth_web tutorial
我想知道onAuthStateChange
本身是否有问题?