Skip to main content

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 ${dataa'subscriber']r'entitlements']s'pro']o'expires_date']}');
if (dataa'subscriber']r'entitlements']s'pro']o'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');
}
}

 

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