Skip to content

Commit c55c44f

Browse files
authored
Small refactor in DartMessenger.java to use method reference (#178584)
## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent d94afa5 commit c55c44f

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart

engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,7 @@ static class SerialTaskQueue implements DartMessengerTaskQueue {
158158
@Override
159159
public void dispatch(@NonNull Runnable runnable) {
160160
queue.add(runnable);
161-
executor.execute(
162-
() -> {
163-
flush();
164-
});
161+
executor.execute(this::flush);
165162
}
166163

167164
private void flush() {
@@ -176,10 +173,7 @@ private void flush() {
176173
isRunning.set(false);
177174
if (!queue.isEmpty()) {
178175
// Schedule the next event.
179-
executor.execute(
180-
() -> {
181-
flush();
182-
});
176+
executor.execute(this::flush);
183177
}
184178
}
185179
}

0 commit comments

Comments
 (0)