Question

Flutter web: I am getting errors when using Firebase ID

  • 12 January 2023
  • 1 reply
  • 1963 views

Badge +5

I am currently working on a Flutter web application that utilizes the Firestore ID and I am experiencing difficulty in retrieving the user's status. The code I posted below works when I paste in the userID string. But, its throwing various errors when I am retrieving it from firebase. Are there any suggestions or recommendations on how to fix the errors I am facing?

ChromeProxyService: Failed to evaluate expression 'xhr.onError.first.then': InternalError: Expression evaluation in async frames is not supported. No frame with index 14..

 

 

   var userID = await DatabaseService().getUid();

// loginWeb(userID);


Future<http.Response> fetchPost(userID) {
var url = "https://api.revenuecat.com/v1/subscribers/$userID";
var headers = {"accept": "application/json", "X-Platform": "ios", "Content-Type": "application/json", "Authorization": "Bearer **************"};

var response = http.get(Uri.parse(url), headers: headers);

return response;
}

loginWeb(userID) {
try {
fetchPost(userID).then((value) {
var data = jsonDecode(value.body);

debugPrint('User has premium ${data['subscriber']['entitlements']['pro']['expires_date']}');
if (data['subscriber']['entitlements']['pro']['expires_date'] != null) {
debugPrint('User has a pro subscription');
FFAppState().hasSubscription = true;

} else {
debugPrint('User does not have a pro subscription');
FFAppState().hasSubscription = false;

}
});
} catch (e) {
debugPrint('Error logging in user: $e');
}
}

 


1 reply

Userlevel 5
Badge +9

Hello! It seems like the issue is in how Flutter is fetching information (xhr.onError.first.then) and not RevenueCat. The error in this github issue looks very similar: https://github.com/firebase/flutterfire/issues/9934#issuecomment-1316796149 and their resolution is here: https://github.com/firebase/flutterfire/issues/9934#issuecomment-1320837039 I’m not sure if that fix works but it does seem like an issue between Flutter and Firebase and not Flutter/Firebase and RevenueCat. Let me know if you have any other questions!

Reply