Hello, I am logging in with firebase but with the user's uid I want to consult an api-rest and if it brings data it means that it is registered and it shows a screen, otherwise it shows another screen
Future<void> _authStateChanged(AuthUser? user) async {
try {
final usuario = 'uWb0PKBbhBZVirLh0bllk2ncDRp1hhhh';
final dataSource = RestDataSourceMySql();
final result = await dataSource.getName(usuario);
if (user != null && result != null) {
print('trajo datos');
print(result);
emit(AuthSignedWithMysql(user));
} else if (user != null && result == null) {
emit(AuthNoRegister(user));
} else if (user == null) {
emit(AuthSignedOut());
}
} on Exception catch (_) {
print("Se cayo");
}
If it brings data it shows me the new screen without problems, but if it brings the uid and in the rest api it doesn't bring anything I get this message "RangeError (RangeError (index): Invalid value: Valid value range is empty: 0)"