Skip to content
pubscout

flutter_pty

0.4.2, released 2 years ago by terminal.studio

Provides pseudo terminal processes for Flutter apps via native code.

$ flutter pub add flutter_pty
Source repository

What it does

The plugin creates and manages PTY processes on Android, iOS, macOS, Windows, and Linux. It exposes a Dart API to start a shell, read output streams, write input, resize, and kill the process.

AI-written summary of version 0.4.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a real terminal/PTY inside a Flutter app (e.g., terminal emulator, CLI tools).
  • You require cross‑platform native PTY support with environment variable and working‑directory control.

Skip it when

  • You target web or platforms without native build toolchains.
  • You prefer a pure‑Dart solution without native compilation.

Strengths

  • Native PTY implementation works on all major desktop and mobile platforms.
  • Supports resizing, env vars, working directory, and exit codes.
  • Provides a stream of output for reactive handling.

Weaknesses

  • Requires native toolchains and build steps for each platform.
  • Experimental package; may have stability issues compared to mature alternatives.

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
1

Configure the plugin as an FFI plugin in pubspec, ensure Android NDK, Xcode, and CMake are installed, and compile native libraries for each target platform.

import 'package:flutter_pty/flutter_pty.dart';

final pty = Pty.start('bash');
pty.output.listen((data) => print(String.fromCharCodes(data)));
pty.write(Utf8Encoder().convert('ls -al\n'));
pty.resize(30, 80);
pty.kill();

Alternatives

Packages that do the same job and could replace flutter_pty.

  • flutter_flavorizr

    A utility to easily create and configure application flavors in Flutter.

  • dartle

    A Dart-based task runner and build system for defining and executing tasks.

  • passkit

    Pure Dart library to create and read Apple PkPass and order files for Apple Wallet.

  • dxf

    DXF package for Dart to create, read, update and delete AutoCAD DXF files.

Works with

Packages commonly used together with flutter_pty: ones it builds on, ones built on it, and its own family.