Skip to content

feat!: Making add,addAll sync methods#3968

Open
erickzanardo wants to merge 4 commits into
mainfrom
feat/add-method-sync
Open

feat!: Making add,addAll sync methods#3968
erickzanardo wants to merge 4 commits into
mainfrom
feat/add-method-sync

Conversation

@erickzanardo

@erickzanardo erickzanardo commented Jul 22, 2026

Copy link
Copy Markdown
Member

Description

Makes add, addAll and addToParent methods sync.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Indicate which issues this PR resolves, if any. For example:

Part of #1938

@erickzanardo
erickzanardo marked this pull request as draft July 22, 2026 14:39
Comment thread packages/flame/lib/src/components/core/component.dart Outdated
@erickzanardo
erickzanardo requested a review from a team July 22, 2026 18:16
@erickzanardo
erickzanardo marked this pull request as ready for review July 22, 2026 18:16
Comment on lines +223 to +224
world.add(coin);
await coin.mounted;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One footgun with this is that if they do this in onLoad of the component they are adding to it will be a deadlock

Comment thread doc/flame/game.md
@override
Future<void> onLoad() async {
await add(MyCrate());
void onLoad() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature of onLoad shouldn't change right? I think super.onLoad might be needed here too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants