Flutter on Jules: Solving the “dart: command not found” issue

Recently started working on a Flutter project in Jules and immediately hit the wall with the dreaded dart: command not found error. After trying multiple approaches, here’s what actually worked.

TL;DR — Quick Fix. Paste this code in the Project’s configuration tab:

#!/bin/bash
# Direct Flutter SDK Installation Script
# This bypasses package managers and installs Flutter directly
echo "Starting direct Flutter SDK installation..."

# Create a working directory
FLUTTER_DIR="/tmp/flutter_install"
mkdir -p "$FLUTTER_DIR"
cd "$FLUTTER_DIR"
echo "Downloading Flutter SDK 3.19.6..."

# Download Flutter SDK directly from Google's servers
wget -q --show-progress https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.19.6-stable.tar.xz

# Verify download
if [ ! -f "flutter_linux_3.19.6-stable.tar.xz" ]; then
    echo "ERROR: Failed to download Flutter SDK"
    exit 1
fi
echo "Extracting Flutter SDK..."
tar xf flutter_linux_3.19.6-stable.tar.xz

# Verify extraction
if [ ! -d "flutter" ]; then
    echo "ERROR: Failed to extract Flutter SDK"
    exit 1
fi
echo "Flutter SDK extracted successfully!"

# Set up Flutter path for this session
export FLUTTER_ROOT="$FLUTTER_DIR/flutter"
export PATH="$FLUTTER_ROOT/bin:$PATH"
echo "Flutter installation directory: $FLUTTER_ROOT"

# Test Flutter installation
echo "Testing Flutter installation..."
$FLUTTER_ROOT/bin/flutter --version
echo "Running Flutter doctor to check setup..."
$FLUTTER_ROOT/bin/flutter doctor

# If you're in a Flutter project directory, run pub get
if [ -f "pubspec.yaml" ]; then
    echo "Found pubspec.yaml, running flutter pub get..."
    $FLUTTER_ROOT/bin/flutter pub get
else
    echo "No pubspec.yaml found in current directory."
    echo "To use Flutter in your project, navigate to your project directory and run:"
    echo "$FLUTTER_ROOT/bin/flutter pub get"
fi

echo ""
echo "=== YAY! FLUTTER INSTALLATION COMPLETE ==="
echo ""
echo "To use Flutter in this session, use the full path:"
echo "  $FLUTTER_ROOT/bin/flutter [command]"
echo ""
echo "Or add to PATH for this session:"
echo "  export PATH=\"$FLUTTER_ROOT/bin:\$PATH\""
echo ""
echo "Example commands:"
echo "  $FLUTTER_ROOT/bin/flutter create my_app"
echo "  $FLUTTER_ROOT/bin/flutter pub get"
echo "  $FLUTTER_ROOT/bin/flutter run"
echo ""

Then, inside your project, Jules is going to run

/tmp/flutter/bin/flutter pub get
/tmp/flutter/bin/flutter run

That’s it. No PATH fighting, no package manager headaches.

Attempt #1: The Traditional Package Manager Approach

My first instinct was to follow the “standard” approach found in many tutorials:

# Install Dart SDK via apt
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'curl -fsSL https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install -y dart

# Add to PATH
export PATH="$PATH:/usr/lib/dart/bin"

# This is where things went wrong
dart pub global activate flutter

What Went Wrong

The installation seemed to progress fine until we hit this error:

The lower bound of "sdk: '

The installation seemed to progress fine until I hit this error

The Critical Mistake: We were trying to install “flutter” as a Dart package via pub global activate. This is fundamentally wrong because:

  1. The “flutter” package on pub.dev is an old, abandoned package
  2. It has SDK constraints from the pre-null safety era (<2.0.0)
  3. Modern Dart SDK (3.9.3) strictly enforces null safety
  4. Flutter SDK is not a pub package—it’s a complete development toolkit

Attempt #2: The FVM (Flutter Version Manager) Route

Thinking we needed better version management, we tried using FVM:

export PATH="$PATH:/usr/lib/dart/bin" && \
dart pub global activate fvm && \
export PATH="$PATH:/home/user/.pub-cache/bin" && \
fvm use 3.19.6 --force && \
fvm flutter pub get

Even when chaining commands with &&, kept hitting: dart: command not found
fvm: command not found

The Environment Issue:

The execution environment was resetting shell state between commands, making PATH exports ineffective. This is common in:

  • Docker containers
  • CI/CD environments
  • Sandboxed execution environments
  • Some cloud IDEs

No matter how we structured the commands, the PATH modifications wouldn’t persist.

Key Lessons Learned

1. Understand What You’re Installing

Flutter SDK ≠ Flutter pub package. Always verify you’re getting the official SDK.

2. Environment Constraints Are Real

Jules (and similar environments) don’t support traditional PATH modifications. Always have a fallback strategy

3. Direct Downloads Are More Reliable

When package managers fail, direct downloads from official sources often work.

4. Full Paths Beat PATH Dependencies

Using /full/path/to/flutter/bin/flutter is more reliable than depending on PATH.

5. Documentation Ages Quickly

The Flutter ecosystem moves fast. What worked 6 months ago might not work today.

Leave a Reply

Your email address will not be published. Required fields are marked *