DEV Community

krlz
krlz

Posted on

Flutter on Your Phone: Building Games in Termux While Your Laptop Judges You

You know that feeling when your laptop dies, your deadline approaches, and all you have is your phone? Most developers would panic. I opened Termux.

The Audacity of Mobile Development

Let me paint you a picture: I'm on a bus, laptop battery at 0%, with a Flutter game to build. My phone has 80% battery and Termux installed. Challenge accepted.

The Secret Sauce: proot-distro

Here's what nobody tells you about mobile development—your phone is basically a Linux machine cosplaying as a candy dispenser. With proot-distro, we run a full Ubuntu environment:

# Install the magic
pkg install proot-distro
proot-distro install ubuntu
proot-distro login ubuntu
Enter fullscreen mode Exit fullscreen mode

Now you're running Ubuntu. On your phone. On a bus. The person next to you thinks you're hacking the mainframe.

Installing Flutter (The ARM64 Way)

Pre-built Flutter binaries are x64. Your phone is ARM64. The solution? Clone from source like it's 2005:

# Inside Ubuntu proot
apt update && apt install -y curl git unzip xz-utils zip openjdk-17-jdk

# Clone Flutter (ARM64 compatible)
cd /root
git clone https://github.com/flutter/flutter.git -b stable --depth 1
export PATH=/root/flutter/bin:$PATH

# Let Dart figure itself out
flutter precache --linux
flutter doctor
Enter fullscreen mode Exit fullscreen mode

Building a Flame Game

Now the fun part—creating an actual game:

flutter create --platforms linux my_game
cd my_game
flutter pub add flame
Enter fullscreen mode Exit fullscreen mode

And here's a minimal Flame game you can type with your thumbs:

import 'package:flame/game.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(GameWidget(game: MyGame()));
}

class MyGame extends FlameGame {
  @override
  Future<void> onLoad() async {
    // Your game logic here
    // Written on a phone
    // Like a legend
  }
}
Enter fullscreen mode Exit fullscreen mode

The Reality Check

Pros:

  • You can code anywhere
  • Great for emergencies
  • Incredible party trick
  • ~3GB setup, runs surprisingly well

Cons:

  • Your thumbs will hate you
  • Compilation takes... a while
  • The person next to you definitely thinks you're a hacker now

Pro Tips

  1. Use --shared-tmp for file access between Termux and proot:
   proot-distro login ubuntu --shared-tmp
Enter fullscreen mode Exit fullscreen mode
  1. Bluetooth keyboard - Your thumbs will thank you

  2. Fix dpkg interrupts (they happen):

   yes N | dpkg --configure -a
Enter fullscreen mode Exit fullscreen mode

Conclusion

Is developing on your phone practical? Debatable.
Is it possible? Absolutely.
Did I submit that game on time from the bus? You bet I did.

Sometimes the best development environment is the one you have with you. Termux turns your phone into a legitimate development machine—not a replacement for your laptop, but a surprisingly capable backup.

Now if you'll excuse me, I need to charge my laptop. It's been judging me from across the room.


Have you tried mobile development with Termux? Share your war stories in the comments!

Top comments (0)