beamer
beamer copied to clipboard
better error handling when trying to pop the only page
Instead of
RangeError (index): Invalid value: Valid value range is empty: -1
When the exception was thrown, this was the stack:
#0 List.[] (dart:core-patch/growable_array.dart:254:60)
#1 List.removeLast (dart:core-patch/growable_array.dart:325:20)
#2 _defaultOnPopPage (package:beamer/src/beam_page.dart:33:45)
#3 BeamerDelegate.build.<anonymous closure>.<anonymous closure> (package:beamer/src/beamer_delegate.dart:582:53)
#4 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:5020:28)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#3330a
debugOwner: GestureDetector
state: ready
won arena
finalPosition: Offset(121.1, 324.0)
finalLocalPosition: Offset(121.1, 32.0)
button: 1
sent tap down
==============
https://github.com/slovnicki/beamer/issues/272
Just ran into this error as well. In my case, it happened because of Navigator.maybePop()
I/flutter (26681): #0 List.[] (dart:core-patch/growable_array.dart:254:60)
I/flutter (26681): #1 List.removeLast (dart:core-patch/growable_array.dart:325:20)
I/flutter (26681): #2 BeamPage.defaultOnPopPage (package:beamer/src/beam_page.dart:47:47)
I/flutter (26681): #3 BeamerDelegate.build.<anonymous closure>.<anonymous closure> (package:beamer/src/beamer_delegate.dart:620:55)
I/flutter (26681): #4 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:5074:28)
I/flutter (26681): #5 Navigator.pop (package:flutter/src/widgets/navigator.dart:2613:27)
I/flutter (26681): #6 BackHelper.build.<anonymous closure> (package:nocd/utils/back_helper.dart:39:21)
I/flutter (26681): #7 ModalRoute.willPop (package:flutter/src/widgets/routes.dart:1360:25)
I/flutter (26681): #8 NavigatorState.maybePop (package:flutter/src/widgets/navigator.dart:5020:67)
I/flutter (26681): #9 Navigator.maybePop (package:flutter/src/widgets/navigator.dart:2563:34)
This also raises the question of whether the correct response is returned to maybePop?