RafaelBarbosatec / gif_view

Load GIF images and can set framerate
MIT License
15 stars 18 forks source link

RangeError (index): Invalid value: Not in inclusive range 0..59: 88 #20

Open daverin opened 3 months ago

daverin commented 3 months ago

I am receiving the following error:

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..59: 88
#0      List.[] (dart:core-patch/growable_array.dart:264:36)
#1      GifController._runNextFrame (package:gif_view/src/gif_controller.dart:46:33)
#2      GifController._run (package:gif_view/src/gif_controller.dart:33:9)
#3      GifController.play (package:gif_view/src/gif_controller.dart:94:7)
#4      GifController.configure (package:gif_view/src/gif_controller.dart:119:9)
#5      GifViewState._loadImage (package:gif_view/gif_view.dart:272:18)
<asynchronous suspension>

The following RangeError was thrown building GifView(dirty, state: GifViewState#e8d50(tickers:
tracking 1 ticker)):
RangeError (index): Invalid value: Not in inclusive range 0..59: 88

The relevant error-causing widget was:
  GifView
  GifView:file:///Users/daverin/Simulon/simulon-app/lib/ui/zen/components/zen_capture_guide/dialogs/giff_dialog.dart:102:44

When the exception was thrown, this was the stack:
#0      List.[] (dart:core-patch/growable_array.dart:264:36)
growable_array.dart:264
#1      GifController.currentFrame (package:gif_view/src/gif_controller.dart:71:39)
gif_controller.dart:71
#2      GifViewState.build (package:gif_view/gif_view.dart:213:25)
gif_view.dart:213
#3      StatefulElement.build (package:flutter/src/widgets/framework.dart:5409:27)
framework.dart:5409
#4      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5297:15)
framework.dart:5297
#5      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)
framework.dart:5462
#6      Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)
framework.dart:5016
#7      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2779:19)
framework.dart:2779
#8      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:916:21)
binding.dart:916
#9      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)
binding.dart:360
#10     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)
binding.dart:1297
#11     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)
binding.dart:1227
#12     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)
binding.dart:1085
#13     _invoke (dart:ui/hooks.dart:170:13)
hooks.dart:170
#14     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
platform_dispatcher.dart:401
#15     _drawFrame (dart:ui/hooks.dart:140:31)
hooks.dart:140
await showModal(
  context: context,
  configuration: const FadeScaleTransitionConfiguration(
    transitionDuration:
        AnimationConstants.lightCaptureDrawerOpenClose,
    reverseTransitionDuration:
        AnimationConstants.standardZenDuration,
  ),
  builder: (context) => GuideDialog(
        dialogPage: GiffDialog(
          gif: 'assets/gifs/walk_up.gif',
          title: 'Stand near action area',
          body:
              'Position yourself near the area where you plan to add 3D assets.',
          actionFunction: (dialogContext) {
            DialogNavigator.of(dialogContext).push(
              FluidDialogPage(
                builder: (_) => GiffDialog(
                  gif: 'assets/gifs/exposure_calibration.gif',
                  title: 'Set the exposure',
                  body:
                      'Calibrate your camera\'s exposure by aiming at the brightest area.',
                  actionFunction: (innerDialogContext) {
                    ref
                        .read(
                            cubeCaptureStateProvider.notifier)
                        .startUIDelay();
                    ref
                        .read(workspaceStateProvider.notifier)
                        .guideStandingInCentreNextStep();
                    Navigator.pop(context);
                  },
                  actionText: 'Got it',
                ),
              ),
            );
          },
          actionText: 'I\'m here',
        ),
      ));

The error is not consistent. It seems to be mixing up the gif data of different widgets. The 0..59 range it references belongs to the assets/gifs/exposure_calibration.gif yet this is being thrown when displaying assets/gifs/walk_up.gif.

nugrahazzz commented 4 weeks ago

Facing a similar issue, has a solution been found?