Skip to content

Errors Encountered During Flutter Tests #646

Open
@badnikhil

Description

@badnikhil

Describe the bug/problem

When running flutter test, the following errors are encountered:

  1. Pending Timer Error

    • Exception:
      ═╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════
      The following assertion was thrown running a test:
      A Timer is still pending even after the widget tree was disposed.
      'package:flutter_test/src/binding.dart':
      Failed assertion: line 1606 pos 12: '!timersPending'
      
    • Possible Cause:
      A timer remains active after the widget tree has been disposed.
  2. Late Initialization Error

    • Exception:
      ═╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═
      The following LateError was thrown while finalizing the widget tree:
      LateInitializationError: Field '_videoController@28198544' has not been initialized.
      
    • Possible Cause:
      The _videoController field is not properly initialized before usage, leading to this error during widget disposal.

Steps to Reproduce the bug/problem

  1. Open the project in a preferred IDE (e.g., VS Code, Android Studio).
  2. Run the command:
    flutter test

Expected behavior

The tests should pass successfully without encountering Pending Timer or LateInitializationError issues.

Device Info (The device where you encountered this issue)

  • OS: Ubuntu 24.04.1 LTS

Additional Notes

  • I discussed this with a experienced flutter dev and he concluded that the latetimer error is related to the video_player package (version 2.9.3) Not the project Codebase
  • The late initialization error might indicate that _videoController should be initialized earlier in the widget -lifecycle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions