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
Describe the bug
A LateInitializationError occurs during a Flutter test when attempting to pick a file using the file_picker package. The error is caused by the uninitialized field _instance in the FilePicker class. The file pick is working perfectly but the test case is giving error.
The test will fail with the LateInitializationError.
Error Log
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following LateError was thrown running a test:
LateInitializationError: Field '_instance@1894507694' has not been initialized.
(elided 5 frames from dart:async and package:stack_trace)
The test description was:
renders correctly when file pick in file edit is failed due to excess file size
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: renders correctly when file pick in file edit is failed due to excess file size
Flutter Version details
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.5 23F79 darwin-x64, locale en-US)
• Flutter version 3.27.1 on channel stable at /Users/hadia/Documents/src/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (3 weeks ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/hadia/Library/Android/sdk
✗ cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.1
The text was updated successfully, but these errors were encountered:
Describe the bug
A LateInitializationError occurs during a Flutter test when attempting to pick a file using the file_picker package. The error is caused by the uninitialized field _instance in the FilePicker class. The file pick is working perfectly but the test case is giving error.
Platform
Web
Platform OS version
How are you picking?
this is the test widget
I'm using this code to pick the file
Details to reproduce the issue
Error Log
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following LateError was thrown running a test:
LateInitializationError: Field '_instance@1894507694' has not been initialized.
When the exception was thrown, this was the stack:
#0 FilePicker._instance (package:file_picker/src/file_picker.dart)
#1 FilePicker.platform (package:file_picker/src/file_picker.dart:37:37)
#2 SXFilePicker.pickCustomFile (package:socxly/common/image_picker.dart:21:49)
#3 OriginalUrlWidget.build. (package:socxly/shortx_create/view/shortx_edit_create_custom_views.dart:132:52)
#4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:351:24)
#5 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:656:11)
#6 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:313:5)
#7 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:246:7)
#8 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:703:9)
#9 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
#10 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:143:9)
#11 _LinkedHashMapMixin.forEach (dart:_compact_hash:726:13)
#12 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
#13 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
#14 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:502:19)
#15 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:482:22)
#16 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:457:11)
#17 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:427:7)
#18 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:390:5)
#19 TestWidgetsFlutterBinding.handlePointerEventForSource. (package:flutter_test/src/binding.dart:677:42)
#20 TestWidgetsFlutterBinding.withPointerEventSource (package:flutter_test/src/binding.dart:687:11)
#21 TestWidgetsFlutterBinding.handlePointerEventForSource (package:flutter_test/src/binding.dart:677:5)
#22 WidgetTester.sendEventToBinding. (package:flutter_test/src/widget_tester.dart:878:15)
#25 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:74:41)
#26 WidgetTester.sendEventToBinding (package:flutter_test/src/widget_tester.dart:877:27)
#27 TestGesture.up. (package:flutter_test/src/test_pointer.dart:558:26)
#30 TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:74:41)
#31 TestGesture.up (package:flutter_test/src/test_pointer.dart:551:27)
#32 WidgetController.tapAt. (package:flutter_test/src/controller.dart:1096:21)
#33 TestAsyncUtils.guard. (package:flutter_test/src/test_async_utils.dart:120:7)
#34 main.. (file:///Users/hadia/Documents/GitHub/socxly/test/shortx_edit_page_test.dart:796:9)
#35 testWidgets.. (package:flutter_test/src/widget_tester.dart:189:15)
#36 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1027:5)
(elided 5 frames from dart:async and package:stack_trace)
The test description was:
renders correctly when file pick in file edit is failed due to excess file size
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: renders correctly when file pick in file edit is failed due to excess file size
Flutter Version details
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.5 23F79 darwin-x64, locale en-US)
• Flutter version 3.27.1 on channel stable at /Users/hadia/Documents/src/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 17025dd882 (3 weeks ago), 2024-12-17 03:23:09 +0900
• Engine revision cb4b5fff73
• Dart version 3.6.0
• DevTools version 2.40.2
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/hadia/Library/Android/sdk
✗ cmdline-tools component is missing
Run
path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run
flutter doctor --android-licenses
to accept the SDK licenses.See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16B40
• CocoaPods version 1.16.1
The text was updated successfully, but these errors were encountered: