snapp_cli는 Raspberry Pi와 같은 장치에서 Flutter 애플리케이션을 설정하고 원격으로 디버그하는 것을 간소화하는 Dart 명령줄 도구입니다. Flutter-pi와 같은 사용자 정의 임베더와 통합되어 구성 작업을 자동화하여 개발 워크플로우를 최적화합니다. 임베디드 또는 헤드리스 Flutter 환경에서 작업하는 개발자를 위한 것으로, 복잡한 수동 설정 없이 빠른 배포 및 실시간 디버깅을 가능하게 합니다. macOS, Windows, Linux를 지원하여 주요 개발 플랫폼에서 접근 가능합니다.
사용 사례
라즈베리파이에서 플러터 앱 원격 디버깅
Flutter-pi 임베더를 위한 자동 설정
임베디드 장치를 위한 크로스 플랫폼 개발
헤드리스 장치에 Flutter 앱을 빠르게 배포하기
IoT 프로젝트를 위한 개선된 CI/CD 파이프라인
주요 기능
Flutter-pi용 자동 구성
CLI를 통한 원격 디버깅
macOS, Windows 및 Linux 지원
사용자 정의 Flutter 임베더와의 원활한 통합
단일 명령어를 통한 설정 및 배포
적합한 대상
Raspberry Pi를 사용하는 IoT 개발자
임베디드 플러터 애플리케이션 생성자
헤드리스 장치에 Flutter를 배포하는 팀
자동 장치 설정을 원하는 개발자
CI/CD 파이프라인 통합자
고려 사항
Flutter-pi와 같은 호환되는 사용자 정의 임베더가 필요합니다
Dart CLI를 지원하는 장치에 한정
원격 디버깅을 위해 네트워크 연결이 필요합니다
대상 장치에서 추가 시스템 종속성이 필요할 수 있습니다
모바일 또는 데스크톱 앱 개발을 위한 것이 아님
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
snapp_cli
Power Up Your Raspberry Pi for Flutter
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:
🔗 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.
🔧 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.
⚙️ 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.
🛠️ 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
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:
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:
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.
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.
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.
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.