In my opinion, tokenGetter should have a FutureOr<Auth> Function()? type.
Here're 2 changes:
Change the actual acceptable type to Auth so that we can construct it manually with Auth(...) rather than convert return value from our function into a patterned json. For example, Aliyun's TypeScript STS SDK @alicloud/sts20150401 would return a camelCase json, while the patterned json use a PascalCase json. As a result, we have to make a conversion here.
Replace Future<T> with FutureOr<T>, since it would allow user to write simpler code here rather than wrap it with () async => or something alike while the token can be access synchronously.
In my opinion,
tokenGetter
should have aFutureOr<Auth> Function()?
type.Here're 2 changes:
Auth
so that we can construct it manually withAuth(...)
rather than convert return value from our function into a patterned json. For example, Aliyun's TypeScript STS SDK@alicloud/sts20150401
would return a camelCase json, while the patterned json use a PascalCase json. As a result, we have to make a conversion here.Future<T>
withFutureOr<T>
, since it would allow user to write simpler code here rather than wrap it with() async =>
or something alike while the token can be access synchronously.