value property
T
value
The variable's value.
Implementation
T get value {
if (!_cached) {
var value = _callback!();
_value = value is T ? value : defaultValue;
_cached = true;
}
// We can't use `!` here because `T` might itself be a nullable type. We
// don't necessarily know that `_value` isn't null, we just know that it's
// the value returned by `_callback`.
return _value as T;
}
void
value=(T value)
Implementation
set value(T value) {
if (_frozen) {
throw StateError(
"Can't modify a ConfigVariable after pkg.add*Tasks() has been "
"called.");
}
_callback = null;
_value = value;
_cached = true;
}