From 4f841bfd9041520dfb09d32f154974fd461b2f81 Mon Sep 17 00:00:00 2001
From: SamJakob <me@samjakob.com>
Date: Wed, 7 Jun 2023 02:44:27 +0100
Subject: [PATCH] Add a .components convenience getter to artboard

---
 lib/src/rive_core/artboard.dart | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/src/rive_core/artboard.dart b/lib/src/rive_core/artboard.dart
index 68fe552f..06050dc7 100644
--- a/lib/src/rive_core/artboard.dart
+++ b/lib/src/rive_core/artboard.dart
@@ -110,6 +110,14 @@ class Artboard extends ArtboardBase with ShapePaintContainer {
     return null;
   }
 
+  /// Find all components of a specific type with a specific name.
+  List<T?> components<T>(String name) {
+    return _components
+      .forEach((component is T && component.name == name))
+      .map((component) => component as T)
+      .toList();
+  }
+
   @override
   Artboard get artboard => this;