搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.0

snapp_cli

使用 Dart CLI 輕鬆在樹莓派和其他設備上設定與遠端偵錯 Flutter 應用程式。支援自訂嵌入器(如 Flutter-pi)並提供自動化設定。

macOSWindowsLinux
近 30 天下載
55
喜歡數
22
Pub 分數
130

安裝套件

flutter pub add snapp_cli

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

snapp_cli 是一個 Dart 命令列工具,可簡化在 Raspberry Pi 等裝置上設定與遠端除錯 Flutter 應用程式的過程。它與自訂嵌入器(例如 Flutter-pi)整合,自動化設定以簡化開發工作流程。專為在嵌入式或無頭 Flutter 環境中工作的開發者設計,可實現快速部署與即時除錯,無需複雜的手動設定。該工具支援 macOS、Windows 與 Linux,讓其可在主要開發平台使用。

適用情境

  • 在樹莓派上遠端調試Flutter應用
  • Flutter-pi 嵌入器的自動化設定
  • 跨平台嵌入式設備開發
  • 快速將Flutter應用部署到無頭設備
  • 物聯網專案的一體化CI/CD流程

主要特色

  • Flutter-pi 的自動設定
  • 透過 CLI 進行遠端偵錯
  • 支援 macOS、Windows 與 Linux
  • 與自定義 Flutter 嵌入程式無縫整合
  • 一指令設定與部署

適合對象

  • 使用 Raspberry Pi 的 IoT 開發人員
  • 嵌入式 Flutter 應用建立者
  • 將 Flutter 部署到無頭設備的團隊
  • 尋求自動化設備設定的開發者
  • CI/CD 流水線整合者

使用建議

  • 需要相容的自定嵌入器,例如 Flutter-pi
  • 僅限支援 Dart CLI 的裝置
  • 遠端偵錯需要網路連接
  • 目標設備上可能需要額外的系統依賴項
  • 不適用於行動或桌面應用程式開發

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

snapp_cli Pub Version

Power Up Your Raspberry Pi for Flutter

Styles

What is snapp_cli?

Imagine You have a Raspberry Pi sitting on your desk or tucked away in a drawer, collecting dust. You bought it with grand ideas of developing Flutter apps on it, but the thought of setting it up for development has always seemed too complicated. Now, picture a tool that makes this process simple and effortless – that’s snapp_cli. 🚀

snapp_cli allows you to control everything from your laptop 💻. Here’s how it simplifies your development process:

  1. 🔗 Effortless Connection: snapp_cli sets up a secure, passwordless SSH link from your laptop to your Raspberry Pi, so you can manage it without direct interaction.

  2. 🔧 Automated Installation: snapp_cli automates the installation of Flutter and all necessary dependencies on your Raspberry Pi. You run snapp_cli from your laptop, and it handles everything remotely. But that's not all – snapp_cli also supports custom embedders like Flutter-pi.

  3. ⚙️ Custom Device Configuration: snapp_cli configures your Raspberry Pi to appear as a custom device in your IDE. You can easily select it and run your Flutter apps, just like you would on a phone or emulator.

  4. 🛠️ Seamless Remote Development: Develop and debug your Flutter apps directly from your laptop. snapp_cli enables hot reload, restart, and access to DevTools, so you can run and test apps on your Raspberry Pi with all the tools you need for smooth and efficient remote development.

In essence, snapp_cli transforms your idle Raspberry Pi into a powerful Flutter development platform, all managed from your laptop. Whether you're new to Flutter or an experienced developer, snapp_cli makes remote development simple and effective.

Installation

snapp_cli is a Dart-based command-line tool. If you already have Flutter installed on your laptop, getting snapp_cli up and running is quick and easy. Just run the following command in your terminal:

dart pub global activate snapp_cli

Make sure that system cache bin directory is added to your system's PATH to use snapp_cli globally. follow this link for more information: Running a script from your PATH

Usage

Using snapp_cli is straightforward. Once installed, you can use it to set up and manage your Raspberry Pi for Flutter development. Let's start with bootstrap command.

Bootstrap Command

The most important command in snapp_cli is the bootstrap command. This command is interactive and guides you through the entire setup process, making your remote device(Raspberry Pi) ready for Flutter development with minimal effort.

To use the bootstrap command, simply run:

$ snapp_cli bootstrap

Styles

The bootstrap command simplifies the entire setup process for your Raspberry Pi. It prompts for your Raspberry Pi's IP address and username to establish a passwordless SSH connection. You'll then choose a Flutter Embedder (Flutter Desktop, Flutter Pi or ...), and the command checks and installs it along with any necessary dependencies. Finally, it configures your Raspberry Pi as a custom device in the Flutter SDK, allowing you to select and run your Flutter apps on the Raspberry Pi directly from your laptop, enabling seamless remote debugging and development.

Other Commands

snapp_cli includes additional commands to help you manage your devices and SSH connections efficiently:

Styles

The devices command helps you manage your custom devices in the Flutter SDK. With subcommands to add, delete, list, and update the IP addresses of your devices, you have full control over your development environment.

The ssh command assists in establishing and managing secure, passwordless SSH connections to your remote devices. Subcommands are available to create and test SSH connections, making remote access and management straightforward.


Each command has specific options and usage, which you can explore further by running snapp_cli --help or snapp_cli <command> --help.

Troubleshooting

Running Commands in Verbose Mode

If you encounter any issues while using the snapp_cli tool, you can run the commands in verbose mode to obtain more detailed information about the error. To do this, simply add the -v flag to your command. For example:

$ snapp_cli bootstrap -v
SSH Connection Issues

Sometimes, you may face difficulties establishing an SSH connection to a device due to various reasons, such as an incorrect IP address, username, password, or SSH key. To verify whether the SSH connection is functioning correctly, you can execute the snapp_cli ssh test-connection command. If the connection fails, attempt to establish a new connection using the snapp_cli ssh create-connection command.

If you still cannot establish an SSH connection, it may be necessary to review the SSH configurations on both your host (e.g., your PC) and the remote device (e.g., Raspberry Pi).

However, be cautious: if you have any other SSH connections to your remote device or to other devices, using the following commands will remove them.

Host Device - Your PC
  • Clear the .snapp_cli directory:
    rm -r ~/.snapp_cli
    
  • Clear the known hosts file:
    ssh-keygen -R yourIpAddress
    
  • Clear the ssh-agent saved keys:
    ssh-add -D
    
Remote Device - Raspberry Pi

Connect to your remote device via a simple SSH connection:

ssh [username]@[ipAddress]

After successfully connecting to your remote device, remove the .ssh folder that contains the SSH keys:

rm -r ~/.ssh
Notes:
  • Ensure you replace yourIpAddress with the actual IP address of your device.
  • Be explicit about replacing placeholders like username@ipAddress with the appropriate user and IP address for the Raspberry Pi.
Manually Editing flutter_custom_devices.json

In some cases, you may need to manually edit the flutter_custom_devices.json file, which stores the configurations for custom devices. Here are the steps to follow if you encounter this situation:

  1. Locate the flutter_custom_devices.json File:

    • The location of the flutter_custom_devices.json file can vary depending on the operating system you are using. You can find it with the snapp_cli list command.
  2. Backup the File:

    • Before making any manual changes, it's a good practice to create a backup of the flutter_custom_devices.json file in case something goes wrong.
  3. Edit the JSON File:

    • Use a text editor to open the flutter_custom_devices.json file. You can make changes to the device configurations as needed. Ensure that the JSON structure is valid; any syntax errors can cause issues.
  4. Test the Configuration:

    • To test the changed configuration you need to run your app again.

Keep in mind that manually editing the flutter_custom_devices.json file should be done with caution, as incorrect changes can lead to configuration issues. It's recommended to use the CLI tool to add, update, or delete custom devices whenever possible.

Contributing

If you encounter any issues with this package or have suggestions for improvements, please open an issue. You are welcome to contribute to the development of this project by forking the repository and submitting pull requests.

License

This project is licensed under the MIT License

所屬分類

依賴

依賴清單 14 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。