!
算什么算_cachedValueFuture
什么?
Future<T> fetch(Future<T> Function() callback) async {
if (_cachedStreamSplitter != null) {
throw StateError('Previously used to cache via `fetchStream`');
}
if (_cachedValueFuture == null) {
_cachedValueFuture = callback();
await _cachedValueFuture;
_startStaleTimer();
}
return _cachedValueFuture!;
}
它是“(not-)null断言运算符”,它将在下一版本中成为具有Null安全功能的Dart的一部分。
该_cachedValueFuture
变量具有类型Future<T>?
,这意味着未来的或零。的!
操作者抛出如果该值null
,所以类型_cachedValueFuture!
就是Future<T>
这是函数的所需要的返回类型。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句