From c2f0ae14092a1b21d4cd5871ca6268857eee916f Mon Sep 17 00:00:00 2001 From: alestiago Date: Thu, 21 Apr 2022 13:58:49 +0100 Subject: [PATCH] refactor: renamed attach --- packages/pinball_flame/lib/src/blueprint.dart | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/pinball_flame/lib/src/blueprint.dart b/packages/pinball_flame/lib/src/blueprint.dart index 5b61446e..cc1d31ae 100644 --- a/packages/pinball_flame/lib/src/blueprint.dart +++ b/packages/pinball_flame/lib/src/blueprint.dart @@ -1,6 +1,5 @@ import 'package:flame/components.dart'; import 'package:flame/game.dart'; -import 'package:flutter/foundation.dart'; // TODO(erickzanardo): Keeping this inside our code base // so we can experiment with the idea, but this is a @@ -27,9 +26,7 @@ class Blueprint extends Component { final List _components = []; - /// Attaches children. - @mustCallSuper - Future _attach(Component parent) async { + Future _addToParent(Component parent) async { await parent.addAll(_components); } @@ -39,9 +36,8 @@ class Blueprint extends Component { /// Adds helper methods regarding [Blueprint]s to [FlameGame]. extension FlameGameBlueprint on Component { - /// Shortcut to attach a [Blueprint] instance to this game - /// equivalent to `MyBluepinrt().attach(game)` + /// Shortcut to add a [Blueprint]s components to its parent. Future addFromBlueprint(Blueprint blueprint) async { - await blueprint._attach(this); + await blueprint._addToParent(this); } }