如何将字段设置为私有并@required
在课堂上对其进行注释?
例如下面的代码给我错误:
class AuthenticationService {
final Api _api;
AuthenticationService({@required this._api}); // error in this line
}
class AuthenticationService {
final Api _api;
AuthenticationService({@required Api api}) : _api = api;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句