The Flutter SDK is installed in a protected folder and may not function correctly

Viewed 4845

The Flutter SDK is installed in a protected folder and may not function correctly.Please move the SDK to a location that is user-writable without Administration permissions and restart.

Above warning pops up when i open the VSCode even though i am running it as administrator. My flutter sdk resides in c:\program files\flutter

And when I try to run any flutter command from either vscode terminal or cmd(run as admin) it gives below error:

Unhandled exception:
SocketException: OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
, errno = 10057, address = 169.254.169.254, port = 49839
#0      AzureDetector.isRunningOnAzure (package:flutter_tools/src/base/bot_detector.dart:91:41)
<asynchronous suspension>
#1      BotDetector.isRunningOnBot (package:flutter_tools/src/base/bot_detector.dart:66:31)
#2      isRunningOnBot (package:flutter_tools/src/globals.dart:77:48)
#3      run (package:flutter_tools/runner.dart:38:36)
#4      main (package:flutter_tools/executable.dart:67:9)
#5      main (file:///C:/Program%20Files/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#6      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)```


2 Answers

The program files folder is protected in windows. you should not install flutter there. move it to another directory like c:\src\flutter and then go to Environment variables add the new directory's bin folder to path.

The initial warning about protected folder went away thanks to the accepted answer. But was still getting the error on running any flutter commands. My problem solved when i upgraded the flutter version and now i can run any command.

Related