getValue<TValue> method

TValue? getValue<TValue>(
  1. Object propertyKey, {
  2. bool requiredProperty = false,
  3. TValue? defaultValue,
})

获取指定 propertyKey 对应的属性值

propertyKey 属性键

requiredProperty 指定 propertyKey 对应属性是否必须存在, 其值为 true 时, 如 propertyKey 对应属性不存在则抛出异常 默认值为 false

defaultValue 当属性不存在时则使用此值, 仅在 requiredPropertyfalse 时有效

Implementation

TValue? getValue<TValue>(Object propertyKey,
        {bool requiredProperty = false, TValue? defaultValue}) =>
    getProperty<TValue>(propertyKey, required: requiredProperty)?.value ??
    defaultValue;