You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be cool if we could have snippets where we can omit things
// snippet-start#dangerousFuture<void> dangerousCall() async {
// Do x-y-z.// snippet-omit-start// 1. Get the Activity (e.g., Activity "A")final activity =androidActivity(engineId);
// 2. An `await` occurs. The main thread is freed.// While waiting, Android might destroy Activity "A" and create "B".awaitsomeOtherFuture();
// 3. CRASH: The code resumes, but `activity` is now a stale// reference to the destroyed Activity "A".if (activity !=null) {
someGeneratedApi.doSomething(activity); // This will crash
activity.release();
}
// snippet-omit-end
}
// snippet-end#dangerous
Which would then become
Future<void> dangerousCall() async {
// Do x-y-z.// [...]
}
hii @liamappelbe, I’d like to work on this issue.
I’ve been looking through the snippet tooling changes from #3641, and I’m interested in implementing support for snippet-omit-start / snippet-omit-end.
Activity
vikramsingh920 commentedon Sep 25, 2026
hii @liamappelbe, I’d like to work on this issue.
I’ve been looking through the snippet tooling changes from #3641, and I’m interested in implementing support for
snippet-omit-start/snippet-omit-end.Would it be okay if I take this issue?
liamappelbe commentedon Sep 28, 2026
This is just some low priority internal infrastructure. I'm not sure we have a use case for it yet. Probably best to wait until we do.