ensureProperty<TValue> method
确认指定 propertyKey
对应的绑定属性
- 如对应属性不存在,且
initialValue
不为null
则使用initialValue
注册一个值绑定属性 否则抛出异常
propertyKey
属性键
Implementation
BindableProperty<TValue> ensureProperty<TValue>(Object propertyKey,
{TValue? initialValue}) {
var property =
getProperty<TValue>(propertyKey, required: initialValue == null);
if (property == null && initialValue != null) {
property = PreBindableProperty(initialValue: initialValue);
registerProperty(propertyKey, property);
}
return property!;
}