Skip to content

fix snakeyaml import #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2023
Merged

fix snakeyaml import #21

merged 1 commit into from
Aug 23, 2023

Conversation

bryanoltman
Copy link

Verified this works on mac and windows.

Fixes issue where building android appbundle fails with error:

⑆ /Users/bryanoltman/.shorebird/bin/cache/flutter/3612c8dc659dd7866578b19396efcb63cad71bef/bin/flutter build appbundle --release

startup failed:
/Users/bryanoltman/.shorebird/bin/cache/flutter/3612c8dc659dd7866578b19396efcb63cad71bef/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy: 1125: unable to resolve class Yaml
 @ line 1125, column 41.
             def shorebirdYaml = new Yaml()
                                 ^

1 error

@bryanoltman bryanoltman merged commit 7b63f1b into shorebird/dev Aug 23, 2023
@bryanoltman bryanoltman deleted the bo/groovy-yaml-fix branch August 23, 2023 20:43
felangel added a commit that referenced this pull request Aug 24, 2023
felangel pushed a commit that referenced this pull request Aug 31, 2023
felangel added a commit that referenced this pull request Aug 31, 2023
eseidel pushed a commit that referenced this pull request Sep 8, 2023
eseidel pushed a commit that referenced this pull request Sep 8, 2023
eseidel pushed a commit that referenced this pull request Sep 20, 2023
eseidel pushed a commit that referenced this pull request Sep 20, 2023
eseidel pushed a commit that referenced this pull request Sep 21, 2023
eseidel pushed a commit that referenced this pull request Sep 21, 2023
eseidel pushed a commit that referenced this pull request Oct 2, 2023
eseidel pushed a commit that referenced this pull request Oct 2, 2023
eseidel pushed a commit that referenced this pull request Oct 13, 2023
eseidel pushed a commit that referenced this pull request Oct 13, 2023
eseidel pushed a commit that referenced this pull request Oct 19, 2023
eseidel pushed a commit that referenced this pull request Oct 19, 2023
felangel pushed a commit that referenced this pull request Oct 26, 2023
felangel added a commit that referenced this pull request Oct 26, 2023
felangel pushed a commit that referenced this pull request Dec 11, 2023
This is a follow up to the following pull requests:
- flutter#124514

I was finally able to reproduce this bug and found out why it was happening. Consider this code:

```dart
GestureDetector(
  behavior: HitTestBehavior.translucent,
  // Note: Make sure onTap is not null to ensure events
  // are captured by `GestureDetector`
  onTap: () {},
  child: _shouldShowSlider
    ? Slider(value: _value, onChanged: _handleSlide)
    : const SizedBox.shrink().
)
```

Runtime exception happens when:

1. User taps and holds the Slider (drag callback captured by `GestureDetector`)
2. `_shouldShowSlider` changes to false, Slider disappears and unmounts, and unregisters `_handleSlide`. But the callback is still registered by `GestureDetector`
3. Users moves finger as if Slider were still there
4. Drag callback is invoked, `_SliderState.showValueIndicator` is called
5. Exception - Slider is already disposed

This pull request fixes it by adding a mounted check inside `_SliderState.showValueIndicator` to ensure the Slider is actually mounted at the time of invoking drag event callback. I've added a unit test that will fail without this change.

The error stack trace is:

```
The following assertion was thrown while handling a gesture:
This widget has been unmounted, so the State no longer has a context (and should be considered
defunct).
Consider canceling any active work during "dispose" or using the "mounted" getter to determine if
the State is still active.

When the exception was thrown, this was the stack:
#0      State.context.<anonymous closure> (package:flutter/src/widgets/framework.dart:950:9)
#1      State.context (package:flutter/src/widgets/framework.dart:956:6)
#2      _SliderState.showValueIndicator (package:flutter/src/material/slider.dart:968:18)
#3      _RenderSlider._startInteraction (package:flutter/src/material/slider.dart:1487:12)
#4      _RenderSlider._handleDragStart (package:flutter/src/material/slider.dart:1541:5)
#5      DragGestureRecognizer._checkStart.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:531:53)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24)
#7      DragGestureRecognizer._checkStart (package:flutter/src/gestures/monodrag.dart:531:7)
#8      DragGestureRecognizer._checkDrag (package:flutter/src/gestures/monodrag.dart:498:5)
#9      DragGestureRecognizer.acceptGesture (package:flutter/src/gestures/monodrag.dart:431:7)
#10     _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:45:14)
#11     GestureArenaManager._resolveInFavorOf (package:flutter/src/gestures/arena.dart:281:12)
#12     GestureArenaManager._resolve (package:flutter/src/gestures/arena.dart:239:9)
#13     GestureArenaEntry.resolve (package:flutter/src/gestures/arena.dart:53:12)
#14     _CombiningGestureArenaMember._resolve (package:flutter/src/gestures/team.dart:85:15)
#15     _CombiningGestureArenaEntry.resolve (package:flutter/src/gestures/team.dart:19:15)
#16     OneSequenceGestureRecognizer.resolve (package:flutter/src/gestures/recognizer.dart:375:13)
#17     DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:414:13)
#18     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#19     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
#20     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#21     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#22     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#23     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:488:19)
#24     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22)
#25     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:439:11)
#26     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7)
#27     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5)
#28     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7)
#29     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9)
#30     _invoke1 (dart:ui/hooks.dart:186:13)
#31     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:433:7)
#32     _dispatchPointerDataPacket (dart:ui/hooks.dart:119:31)

Handler: "onStart"
Recognizer:
  HorizontalDragGestureRecognizer#a5df2
```

*List which issues are fixed by this PR. You must list at least one issue.*

Internal bug: b/273666179, b/192329942

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
felangel pushed a commit that referenced this pull request Jan 16, 2024
felangel added a commit that referenced this pull request Jan 16, 2024
bryanoltman added a commit that referenced this pull request Feb 5, 2024
bryanoltman pushed a commit that referenced this pull request Feb 5, 2024
felangel pushed a commit that referenced this pull request May 30, 2025
Fixes error found in rolling to google.

```
[☠] Android toolchain - develop for Android devices (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message
      below is not helpful, please let us know about this issue at
      https://github.com/flutter/flutter/issues.
    ✗ type 'Null' is not a subtype of type 'String' of 'executable'
    • #0      LocalProcessManager.canRun
      (package:process/src/interface/local_process_manager.dart:124)
      #1      getEmulatorVersion
      (package:flutter_tools/src/android/android_workflow.dart:64)
      #2      AndroidValidator.validateImpl
      (package:flutter_tools/src/android/android_workflow.dart:200)
      #3      DoctorValidator.validate
      (package:flutter_tools/src/doctor_validator.dart:58)
      #4      Doctor.startValidatorTasks.<anonymous closure>
      (package:flutter_tools/src/doctor.dart:244)
      #5      asyncGuard.<anonymous closure>
      (package:flutter_tools/src/base/async_guard.dart:109)
      #6      _rootRun (dart:async/zone.dart:1525)
      #7      _CustomZone.run (dart:async/zone.dart:1422)
      #8      _runZoned (dart:async/zone.dart:2033)
      #9      runZonedGuarded (dart:async/zone.dart:2019)
      #10     runZoned (dart:async/zone.dart:1952)
      #11     asyncGuard (package:flutter_tools/src/base/async_guard.dart:106)
      #12     Doctor.startValidatorTasks
      (package:flutter_tools/src/doctor.dart:234)
      #13     Doctor.diagnose (package:flutter_tools/src/doctor.dart:372)
      #14     DoctorCommand.runCommand
      (package:flutter_tools/src/commands/doctor.dart:59)
      #15     FlutterCommand.verifyThenRunCommand
      (package:flutter_tools/src/runner/flutter_command.dart:1897)
      <asynchronous suspension>
      #16     FlutterCommand.run.<anonymous closure>
      (package:flutter_tools/src/runner/flutter_command.dart:1551)
      <asynchronous suspension>
      #17     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:154)
      <asynchronous suspension>
      #18     CommandRunner.runCommand (package:args/command_runner.dart:212)
      <asynchronous suspension>
      #19     FlutterCommandRunner.runCommand.<anonymous closure>
      (package:flutter_tools/src/runner/flutter_command_runner.dart:501)
      <asynchronous suspension>
      #20     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:154)
      <asynchronous suspension>
      #21     FlutterCommandRunner.runCommand
      (package:flutter_tools/src/runner/flutter_command_runner.dart:438)
      <asynchronous suspension>
      #22     run.<anonymous closure>.<anonymous closure>
      (package:flutter_tools/runner.dart:98)
      <asynchronous suspension>
      #23     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:154)
      <asynchronous suspension>
      #24     AppContext.run.<anonymous closure>
      (package:flutter_tools/src/base/context.dart:154)
      <asynchronous suspension>
      #25     run (package:mobile.flutter.cli/flutter_tools.dart:106)
      <asynchronous suspension>
      #26     main (google3:///mobile/flutter/cli/bin/cli_usage_aot.dart:4)
```

## 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].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] 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].

<!-- 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
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