Exit with error message when run as root (#8626)

diff --git a/bin/flutter b/bin/flutter
index 3f6334d..7487029 100755
--- a/bin/flutter
+++ b/bin/flutter
@@ -46,6 +46,15 @@
 DART="$DART_SDK_PATH/bin/dart"
 PUB="$DART_SDK_PATH/bin/pub"
 
+# Test if running as superuser
+if [[ "$EUID" == "0" ]]; then
+  echo "   Woah! You appear to be trying to run flutter as root."
+  echo "   We strongly recommend running the flutter tool without superuser privileges."
+  echo "  /"
+  echo "📎"
+  exit 1
+fi
+
 # Test if Git is available on the Host
 if ! hash git 2>/dev/null; then
   echo "Error: Unable to find git in your PATH."