Reputation: 2792
i am this as i convert to Null- safety, and i keep getting this error
here is my code
try {
final AuthorizationResult appleResult =
await TheAppleSignIn.performRequests([
AppleIdRequest(requestedScopes: [Scope?.email, Scope?.fullName])
]);
if (appleResult.error != null) {
// handle errors from Apple here
}
final AuthCredential credential = OAuthProvider('apple.com').credential(
accessToken:
String.fromCharCodes(appleResult.credential!.authorizationCode),//here the error coming out.... i have also try Uint8List.fromList but still showing the error
idToken: String.fromCharCodes(appleResult.credential!.identityToken),//here the error coming out.... i have also try Uint8List.fromList but still showing the error
);
final firebaseResult = await auth.signInWithCredential(credential);
users = firebaseResult.user;
if (users == null) {
return false;
}
return true;
} catch (error) {
print(error);
return false;
}
i have also try
Uint8List.from()
Upvotes: 2
Views: 13166
Reputation: 267724
Problem:
Your Uint8List?
is nullable and Iterable<int>
is non-nullable so you can't assign nullable to non-nullable.
Solutions:
Provide a default value if Unit8List?
can be null
.
Iterable<int> iterable = yourUint8List ?? [];
Use bang operator if Uint8List?
can't be null
.
Iterable<int> iterable = yourUint8List!;
Upvotes: 4