flutter_shell 0.0.2 copy "flutter_shell: ^0.0.2" to clipboard
flutter_shell: ^0.0.2 copied to clipboard

A cross-platform utility to execute shell commands in Dart/Flutter apps.

Flutter Shell #

A cross-platform utility for executing shell commands in Dart/Flutter apps.

Pub Version Build Status License


πŸ”§ Features #

  • Supports Windows (powershell / cmd.exe)
  • Supports macOS/Linux (zsh, bash, sh)
  • Gracefully rejects execution on Android/iOS with a clear message
  • Executes multiple commands sequentially with && chaining
  • Returns trimmed standard output or detailed error messages
  • Simple static method API for quick integration

πŸš€ Usage #

import 'package:flutter_shell/flutter_shell.dart';

void main() async {
  final result = await ShellExecutor.executeCommands([
    'echo Hello',
    'echo World',
  ]);

  print(result);
}

🧩 API Reference #

ShellExecutor.executeCommands #

static Future<String> executeCommands(List<String> commands)
  • Executes the provided list of shell commands sequentially in a platform-appropriate shell.

  • Returns a Future<String> which is:

    • The trimmed standard output (stdout) on success.
    • An error message string prefixed with ❌ on failure.
    • A platform-specific unsupported message on mobile platforms.

πŸ› οΈ Installation #

Add the package to your pubspec.yaml:

dependencies:
  flutter_shell: ^0.0.1

Then run:

flutter pub get

πŸ“‚ Example #

Example CLI usage in bin/main.dart:

import 'package:flutter_shell/flutter_shell.dart';

Future<void> main() async {
  print('πŸš€ Running ShellExecutor from terminal...\n');

  final result = await ShellExecutor.executeCommands([
    'echo Hello',
    'echo from flutter_shell!',
  ]);

  print('πŸ”§ Command output:\n$result');
}

⚠️ Supported Platforms #

  • Windows, macOS, Linux
  • Not supported: Android and iOS (returns an error message)

πŸ’° Support #

If you find this project helpful, consider sponsoring me on GitHub πŸ’–


🀝 Contributing #

Contributions and suggestions are welcome! Feel free to open issues or submit pull requests.


πŸ“„ License #

MIT License Β© 2025 Your Name


πŸ“¬ Contact #

GitHub: https://github.com/ihdatech/flutter_shell

1
likes
160
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

A cross-platform utility to execute shell commands in Dart/Flutter apps.

Repository (GitHub)
View/report issues

Topics

#shell #cli #utility

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

MIT (license)

More

Packages that depend on flutter_shell