8

it's showing like this.

Unhandled exception:
Bad state: Future already completed
#0      _AsyncCompleter.complete (dart:async/future_impl.dart:43:31)
#1      _NativeSocket.startConnect.<anonymous closure>.connectNext.<anonymous closure> (dart:io-patch/socket_patch.dart:678:23)
#2      _NativeSocket.issueWriteEvent.issue (dart:io-patch/socket_patch.dart:1043:14)
#3      _NativeSocket.issueWriteEvent (dart:io-patch/socket_patch.dart:1050:12)
#4      _NativeSocket.multiplex (dart:io-patch/socket_patch.dart:1071:11)
#5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

I totally uninstall flutter from macOS Big Sur. but it's still showing the same result.

2
  • What Dart and Flutter version are you on?
    – Repox
    Commented Nov 18, 2020 at 20:15
  • 1
    I used flutter_macos_1.22.4-stable.zip to install Commented Nov 19, 2020 at 10:04

3 Answers 3

15

It looks like the issue is related to antivirus software.

I tried installing from zip but continued running into the exact same issue with any Flutter commands. I had to temporarily disable Avast Security and everything resolved itself.

Link to issue on GitHub.

Update
Disabling the "Scan Secure Connection" option on the Web Shield lets me keep Avast running without any issue with Flutter.

3
  • Because of above error, I disabled Avast web shield and ran "flutter pub get" in my flutter project and all dependency problem resolved in VScode
    – smile
    Commented Nov 23, 2020 at 20:54
  • @owen its that means when need to run the app, or flutter related command to run then I need to disable Antivirus every time. Commented Nov 25, 2020 at 11:45
  • @mihirpipermitwala I believe it will could any time that you run a command where Flutter attempts to download something from the web that is blocked by your antivirus. The best option is probably to whitelist wherever Flutter is hosting their content, but I just disabled it temporarily and now I'm not having any issues with AV running again.
    – Owen
    Commented Nov 25, 2020 at 16:51
5

I use Avast Security and had to switch off both File Shield and Web Shield in order to "flutter upgrade" and "flutter pub get" on my project.

Switch off these Core Shields if using Avast Security

I imagine will need to do the same to add new dependencies and possibly while building for web which is definitely a pain.

2

I had same issue after upgrade to macos "Big Sur". Also, I have Kaspersky Internet Security. When KIS is disabled I get same issue. But after closing the KIS, command

$ flutter doctor

works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.