我在flutter应用程序中实现了fiebase消息传递。我正在尝试捕获连接错误,例如:
6.26.0 - [Firebase/Messaging][I-FCM002025] Failed to connect to direct channel, error: Error Domain=com.google.fcm Code=4 "No internet available, cannot connect to FIRMessaging" UserInfo={NSLocalizedFailureReason=No internet available, cannot connect to FIRMessaging}
但是没有地方可以抓住它。如何捕获Firebase消息传递连接?
final FirebaseMessaging _fcm = FirebaseMessaging();
_fcm.getToken().then((value) {
_token = value;
print("Message token is: $_token");
}, onError: (err) {
print("getToken onError is: $err");
}).catchError((onError) {
print("getToken catchError is: $onError");
});