maybeOfProperty<T> static method
Optionally find and listen to property changes of the data with the given type from the context. Returns null if the data is not found.
TThe type of the data.contextThe build context.keyThe data key.
Implementation
static ModelProperty<T>? maybeOfProperty<T>(
BuildContext context, Symbol key) {
var model = InheritedModel.inheritFrom<_InheritedModel>(context,
aspect: ModelKey<T>(key));
if (model == null) {
return null;
}
for (final model in model.data) {
if (model.dataKey == key && model.dataType == T) {
if (model is ModelBoundary<T>) {
return null;
}
return model as ModelProperty<T>;
}
}
return null;
}