huhx / flutter_oss_aliyun

阿里云oss sdk的flutter版本
MIT License
61 stars 23 forks source link

Accept better `tokenGetter` on `init` #32

Closed kj415j45 closed 1 year ago

kj415j45 commented 1 year ago

In my opinion, tokenGetter should have a FutureOr<Auth> Function()? type.

Here're 2 changes:

  1. 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.
  2. 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.
huhx commented 1 year ago

感谢你的建议,在6.0.0中已实现