MaikuB/flutter_appauth

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

jeetparte opened this issue · 0 comments

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?