onTimeout is executed after 10 seconds, cancelling the upload task and completing the Future returned from upload with a TimeoutException. On iOS, this works as expected.
Actual behavior
onTimeout is never executed and the Future returned from upload never completes as long as internet access is disabled.
Additional context
Add any other context about the problem here.
Flutter doctor
Click To Expand
```
[β] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-US)
β’ Flutter version 2.2.1 at /Users/jonathan.joelson/repos/flutter
β’ Framework revision 02c026b03c (5 weeks ago), 2021-05-27 12:24:44 -0700
β’ Engine revision 0fdb562ac8
β’ Dart version 2.13.1
[β] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
β’ Android SDK at /Users/jonathan.joelson/Library/Android/sdk
β’ Platform android-30, build-tools 30.0.3
β’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
β’ All Android licenses accepted.
[β] Xcode - develop for iOS and macOS
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Xcode 12.5.1, Build version 12E507
β’ CocoaPods version 1.10.1
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] Android Studio (version 4.1)
β’ Android Studio at /Applications/Android Studio.app/Contents
β’ Flutter plugin can be installed from:
π¨ https://plugins.jetbrains.com/plugin/9212-flutter
β’ Dart plugin can be installed from:
π¨ https://plugins.jetbrains.com/plugin/6351-dart
β’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[β] VS Code (version 1.57.1)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 3.23.0
[β] Connected device (3 available)
β’ Pixel 4a (mobile) β’ 0B201JEC221560 β’ android-arm64 β’ Android 11 (API 30)
β’ iPhone 12 Pro (mobile) β’ E0DB03D5-593F-47B6-BE00-A22084B44198 β’ ios β’
com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 91.0.4472.114
β’ No issues found!
```
Flutter dependencies
Run flutter pub deps -- --style=compact and paste the output below:
Thanks for the detailed report and code sample. Issue replicable using latest stable and plugin version.
flutter doctor -v
```
[β] Flutter (Channel stable, 2.2.2, on Mac OS X 10.15.4 19E2269 darwin-x64,
locale en-GB)
β’ Flutter version 2.2.2 at /Users/dhs/documents/fluttersdk/flutter
β’ Framework revision d79295af24 (11 days ago), 2021-06-11 08:56:01 -0700
β’ Engine revision 91c9fc8fe0
β’ Dart version 2.13.3
[β] Xcode - develop for iOS and macOS
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Xcode 12.3, Build version 12C33
β’ CocoaPods version 1.10.1
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] VS Code (version 1.56.2)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 3.21.0
[β] Connected device (4 available)
β’ SM G975F (mobile) β’ RZ8M802WY0X β’ android-arm64 β’ Android 10 (API 29)
β’ iPhone 12 Pro Max (mobile) β’ A5473606-0213-4FD8-BA16-553433949729 β’
ios β’ com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
β’ macOS (desktop) β’ macos β’
darwin-x64 β’ Mac OS X 10.15.4 19E2269 darwin-x64
β’ Chrome (web) β’ chrome β’
web-javascript β’ Google Chrome 91.0.4472.106
β’ No issues found!
```
Bug report
Describe the bug On Android, calling
timeout
on anUploadTask
does not cause the task to time out if the device is disconnected from the internet.Steps to reproduce
Steps to reproduce the behavior:
Trigger an upload using code similar to the below:
Expected behavior
onTimeout
is executed after 10 seconds, cancelling the upload task and completing the Future returned fromupload
with aTimeoutException
. On iOS, this works as expected.Actual behavior
onTimeout
is never executed and the Future returned fromupload
never completes as long as internet access is disabled.Additional context
Add any other context about the problem here.
Flutter doctor
Click To Expand
``` [β] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-US) β’ Flutter version 2.2.1 at /Users/jonathan.joelson/repos/flutter β’ Framework revision 02c026b03c (5 weeks ago), 2021-05-27 12:24:44 -0700 β’ Engine revision 0fdb562ac8 β’ Dart version 2.13.1 [β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) β’ Android SDK at /Users/jonathan.joelson/Library/Android/sdk β’ Platform android-30, build-tools 30.0.3 β’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java β’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) β’ All Android licenses accepted. [β] Xcode - develop for iOS and macOS β’ Xcode at /Applications/Xcode.app/Contents/Developer β’ Xcode 12.5.1, Build version 12E507 β’ CocoaPods version 1.10.1 [β] Chrome - develop for the web β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [β] Android Studio (version 4.1) β’ Android Studio at /Applications/Android Studio.app/Contents β’ Flutter plugin can be installed from: π¨ https://plugins.jetbrains.com/plugin/9212-flutter β’ Dart plugin can be installed from: π¨ https://plugins.jetbrains.com/plugin/6351-dart β’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [β] VS Code (version 1.57.1) β’ VS Code at /Applications/Visual Studio Code.app/Contents β’ Flutter extension version 3.23.0 [β] Connected device (3 available) β’ Pixel 4a (mobile) β’ 0B201JEC221560 β’ android-arm64 β’ Android 11 (API 30) β’ iPhone 12 Pro (mobile) β’ E0DB03D5-593F-47B6-BE00-A22084B44198 β’ ios β’ com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 91.0.4472.114 β’ No issues found! ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.13.1 Flutter SDK 2.2.1 bluebuffalo_bg_flutter 1.0.0+1 dependencies: - buddies_api 0.0.1 [flutter artemis clock equatable firebase_auth firebase_messaging firebase_performance firebase_storage flutter_secure_storage graphql http json_annotation meta rxdart shared_preferences uuid buddies_models http_proxy] - buddies_models 0.0.1 [flutter clock equatable] - clock 1.1.0 - cupertino_icons 1.0.2 - equatable 2.0.0 [collection meta] - fading_edge_scrollview 2.0.0 [flutter] - firebase_analytics 8.1.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core flutter meta] - firebase_core 1.3.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 2.0.6 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_dynamic_links 2.0.6 [firebase_core flutter] - firebase_messaging 10.0.2 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_performance 0.7.0+5 [firebase_core flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_bloc 7.0.0 [flutter bloc provider] - flutter_html 2.0.0-nullsafety.0 [html csslib css_colors flutter_layout_grid video_player chewie webview_flutter chewie_audio flutter_svg flutter] - flutter_localizations 0.0.0 [flutter intl characters clock collection meta path typed_data vector_math] - flutter_svg 0.21.0+1 [flutter meta path_drawing vector_math xml] - global_configuration 2.0.0-nullsafety.1 [flutter http] - image_cropper 1.4.0 [flutter] - image_picker 0.7.4 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface image_picker_for_web] - intl 0.17.0 [clock path] - logger 1.0.0 - lottie 1.0.1 [archive characters charcode collection flutter logging meta path vector_math] - meta 1.3.0 - path 1.8.0 - path_provider 2.0.1 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows] - permission_handler 6.1.3 [flutter meta permission_handler_platform_interface] - provider 5.0.0 [collection flutter nested] - qr_code_scanner 0.4.0 [flutter] - rxdart 0.26.0 - scroll_to_index 2.0.0 [flutter] - share 2.0.1 [meta mime flutter] - styled_text 3.0.1 [flutter xmlstream] - transparent_image 2.0.0 - url_launcher 6.0.3 [flutter url_launcher_platform_interface url_launcher_linux url_launcher_macos url_launcher_windows url_launcher_web] - uuid 3.0.4 [crypto] - webview_flutter 2.0.4 [flutter] dev dependencies: - bloc_test 8.0.0 [bloc meta mocktail test] - fake_async 1.2.0 [clock collection] - flutter_lints 1.0.3 [lints] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data] transitive dependencies: - _fe_analyzer_shared 20.0.0 [meta] - analyzer 1.4.0 [_fe_analyzer_shared cli_util collection convert crypto glob meta package_config path pub_semver source_span watcher yaml pedantic] - archive 3.1.2 [crypto path] - args 2.0.0 - artemis 7.0.0-beta.3 [build_config code_builder build collection dart_style equatable glob gql_code_builder gql_dedupe_link gql_exec gql_http_link gql_link gql http json_annotation meta path recase source_gen yaml] - async 2.6.1 [meta collection] - bloc 7.0.0 [meta] - boolean_selector 2.1.0 [source_span string_scanner] - build 2.0.0 [analyzer async convert crypto glob logging meta path] - build_config 0.4.7 [checked_yaml json_annotation meta path pubspec_parse yaml] - built_collection 5.0.0 - built_value 8.0.4 [built_collection collection fixnum] - characters 1.1.0 - charcode 1.2.0 - checked_yaml 1.0.4 [json_annotation source_span yaml] - chewie 1.0.0 [cupertino_icons flutter video_player wakelock] - chewie_audio 1.2.0 [cupertino_icons flutter video_player] - cli_util 0.3.0 [meta path] - code_builder 3.7.0 [built_collection built_value collection matcher meta] - collection 1.15.0 - convert 3.0.0 [typed_data] - coverage 1.0.3 [args logging package_config path source_maps stack_trace vm_service] - crypto 3.0.1 [collection typed_data] - css_colors 1.1.0 [flutter] - csslib 0.17.0 [source_span] - dart_style 2.0.0 [analyzer args path pub_semver source_span] - ffi 1.0.0 - file 6.1.0 [meta path] - firebase 9.0.1 [http http_parser js] - firebase_analytics_platform_interface 2.0.1 [flutter meta] - firebase_analytics_web 0.3.0+1 [firebase firebase_analytics_platform_interface flutter flutter_web_plugins meta] - firebase_auth 1.4.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_auth_platform_interface 4.3.1 [firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 1.3.1 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta] - firebase_core_platform_interface 4.0.1 [collection flutter meta plugin_platform_interface] - firebase_core_web 1.1.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.0.6 [collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 3.0.2 [firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 2.0.2 [firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_storage 8.1.3 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firebase_storage_platform_interface 2.1.2 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 1.1.2 [async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - fixnum 1.0.0 - flutter_layout_grid 1.0.1 [flutter collection meta quiver] - flutter_plugin_android_lifecycle 2.0.1 [flutter] - flutter_secure_storage 4.1.0 [meta flutter] - flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math] - glob 2.0.1 [async collection file path pedantic string_scanner] - gql 0.13.0-nullsafety.2 [collection meta source_span] - gql_code_builder 0.2.0-nullsafety.0 [analyzer built_collection built_value code_builder collection gql gql_exec path recase] - gql_dedupe_link 2.0.0-nullsafety.1 [meta gql_exec gql_link async] - gql_error_link 0.2.0-nullsafety.1 [async gql_exec gql_link meta] - gql_exec 0.3.0-nullsafety.2 [collection meta gql] - gql_http_link 0.4.0-nullsafety.1 [meta gql gql_exec gql_link http http_parser] - gql_link 0.4.0-nullsafety.3 [meta gql gql_exec] - gql_transform_link 0.2.0-nullsafety.1 [gql_exec gql_link] - graphql 5.0.0-nullsafety.4 [meta path gql gql_exec gql_link gql_http_link gql_transform_link gql_error_link gql_dedupe_link hive normalize http collection web_socket_channel stream_channel rxdart uuid] - hive 2.0.4 [meta crypto] - html 0.15.0 [csslib source_span] - http 0.13.1 [http_parser meta path pedantic] - http_multi_server 3.0.0 [async] - http_parser 4.0.0 [charcode collection source_span string_scanner typed_data] - http_proxy 1.1.0 [flutter http] - image_picker_for_web 2.0.0 [image_picker_platform_interface meta flutter flutter_web_plugins] - image_picker_platform_interface 2.1.0 [flutter meta http plugin_platform_interface] - io 1.0.0 [meta path string_scanner] - js 0.6.3 - json_annotation 4.0.1 - lints 1.0.1 - logging 1.0.0 - matcher 0.12.10 [stack_trace] - mime 1.0.0 - mocktail 0.1.1 [collection matcher test] - nested 1.0.0 [flutter] - node_preamble 2.0.0 - normalize 0.5.1-0.1.nullsafety.0 [gql collection] - package_config 2.0.0 [path] - path_drawing 0.5.0 [vector_math meta path_parsing flutter] - path_parsing 0.2.0 [vector_math meta] - path_provider_linux 2.0.0 [path xdg_directories path_provider_platform_interface flutter] - path_provider_macos 2.0.0 [flutter] - path_provider_platform_interface 2.0.1 [flutter meta platform plugin_platform_interface] - path_provider_windows 2.0.0 [path_provider_platform_interface meta path flutter ffi win32] - pedantic 1.11.0 - permission_handler_platform_interface 3.2.0 [flutter meta plugin_platform_interface] - petitparser 4.0.2 [meta] - platform 3.0.0 - plugin_platform_interface 2.0.0 [meta] - pool 1.5.0 [async stack_trace] - process 4.2.1 [file path platform] - pub_semver 2.0.0 [collection] - pubspec_parse 0.1.8 [checked_yaml json_annotation pub_semver yaml] - quiver 3.0.1 [matcher] - recase 4.0.0 - shared_preferences 2.0.5 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows] - shared_preferences_linux 2.0.0 [flutter file meta path path_provider_linux shared_preferences_platform_interface] - shared_preferences_macos 2.0.0 [shared_preferences_platform_interface flutter] - shared_preferences_platform_interface 2.0.0 [flutter] - shared_preferences_web 2.0.0 [shared_preferences_platform_interface flutter flutter_web_plugins meta] - shared_preferences_windows 2.0.0 [shared_preferences_platform_interface flutter file meta path path_provider_platform_interface path_provider_windows] - shelf 1.1.0 [async collection http_parser path stack_trace stream_channel] - shelf_packages_handler 3.0.0 [path shelf shelf_static] - shelf_static 1.0.0 [convert http_parser mime path shelf] - shelf_web_socket 1.0.1 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - source_gen 1.0.0 [analyzer async build dart_style glob meta path pedantic source_span] - source_map_stack_trace 2.1.0 [path stack_trace source_maps] - source_maps 0.10.10 [source_span] - source_span 1.8.1 [collection path term_glyph] - stack_trace 1.10.0 [path] - stream_channel 2.1.0 [async] - string_scanner 1.1.0 [charcode source_span] - term_glyph 1.2.0 - test 1.16.8 [analyzer async boolean_selector collection coverage http_multi_server io js node_preamble package_config path pedantic pool shelf shelf_packages_handler shelf_static shelf_web_socket source_span stack_trace stream_channel typed_data web_socket_channel webkit_inspection_protocol yaml test_api test_core] - test_api 0.3.0 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - test_core 0.3.19 [analyzer async args boolean_selector collection coverage glob io meta package_config path pedantic pool source_map_stack_trace source_maps source_span stack_trace stream_channel vm_service yaml matcher test_api] - typed_data 1.3.0 [collection] - url_launcher_linux 2.0.0 [flutter] - url_launcher_macos 2.0.0 [flutter] - url_launcher_platform_interface 2.0.1 [flutter plugin_platform_interface] - url_launcher_web 2.0.0 [url_launcher_platform_interface meta flutter flutter_web_plugins] - url_launcher_windows 2.0.0 [flutter] - vector_math 2.1.0 - video_player 2.1.1 [meta video_player_platform_interface video_player_web flutter flutter_test] - video_player_platform_interface 4.1.0 [flutter meta flutter_test] - video_player_web 2.0.0 [flutter flutter_web_plugins meta video_player_platform_interface] - vm_service 6.1.0+1 - wakelock 0.4.0 [flutter meta wakelock_macos wakelock_platform_interface wakelock_web] - wakelock_macos 0.1.0 [flutter flutter_web_plugins wakelock_platform_interface] - wakelock_platform_interface 0.2.0 [flutter meta] - wakelock_web 0.2.0 [flutter flutter_web_plugins js wakelock_platform_interface] - watcher 1.0.0 [async path pedantic] - web_socket_channel 2.0.0 [async crypto stream_channel] - webkit_inspection_protocol 1.0.0 [logging] - win32 2.0.4 [ffi] - xdg_directories 0.2.0 [meta path process] - xml 5.0.2 [collection meta petitparser] - xmlstream 1.0.0 - yaml 3.1.0 [collection source_span string_scanner] ```