getAnchors<T> method

List<T> getAnchors<T>(
  1. String hookName, {
  2. BuildContext? context,
})

Returns a list of feature anchors of type T that are associated with the given hookName.

Implementation

List<T> getAnchors<T>(
  String hookName, {
  BuildContext? context,
}) {
  final anchors = <T>[];
  for (final feature in _features.values) {
    for (final anchor in feature.anchors(context)) {
      if (anchor.hookName == hookName && anchor is T) {
        anchors.add(anchor as T);
      }
    }
  }
  return anchors;
}