MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
269 stars 238 forks source link

Why does the plugin's API define the responses as nullable? #478

Open jeetparte opened 4 months ago

jeetparte commented 4 months ago

I am just wondering why the plugin API defines the returned responses as null. For example, authorizeAndExchangeCode(AuthorizationTokenRequest request) returns a Future<AuthorizationTokenResponse?> and not Future<AuthorizationTokenResponse>.

I understand that success returns the object and any errors will be reported as exceptions. And I can see that the example code uses the non-null assertion operator (!) on the returned value.

Can we safely assume non-null when no exception is thrown? Is there something in the underlying AppAuth SDKs that necessitates the nullable annotation in the plugin's API?