flutter_blue_app
A Flutter application that uses the flutter_bluetooth_serial
package.
Table of Contents
- Overview
- Setting Up Flutter
- Running the Application
- Building the APK
- Setting Up Android SDK (macOS)
- Setting Up Android SDK (Windows)
- Getting Started
- Additional Resources
Overview
This project is a starting point for a Flutter application that integrates Bluetooth functionality using the flutter_bluetooth_serial
package.
Setting Up Flutter
Installing Flutter on macOS
-
Download Flutter
curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.10.6-stable.zip
Extract the downloaded zip and move it to the desired location:
unzip flutter_macos_3.10.6-stable.zip mv flutter ~/development/flutter
-
Update Environment Variables Add Flutter to the PATH:
export PATH="$PATH:$HOME/development/flutter/bin"
To make this change permanent, add the line above to
~/.zshrc
or~/.bashrc
, depending on your shell. -
Install Dependencies
brew install cocoapods flutter doctor
Follow any additional installation steps suggested by
flutter doctor
.
Installing Flutter on Windows
-
Download Flutter
- Download the Flutter SDK from Flutter Official Site
- Extract it to
C:\src\flutter
-
Update Environment Variables
- Open Edit environment variables from the Start menu.
- Add
C:\src\flutter\bin
to the Path variable.
-
Install Dependencies
- Run:
flutter doctor
- Install any missing dependencies reported by
flutter doctor
.
- Run:
Running the Application
-
Add the Bluetooth Package Dependency
In your project directory, run:flutter pub add flutter_bluetooth_serial:^0.4.0
-
Get Dependencies
Fetch the package:flutter pub get
-
Create Necessary Files
If needed, generate missing files:flutter create .
-
Run the App
Launch the application:flutter run
Building the APK
-
Set Up the Android SDK
Follow the setup instructions below for your operating system. -
Clean and Build
Once the SDK is configured, run:flutter clean flutter build apk --release
Setting Up Android SDK (macOS)
-
Install Android Command-Line Tools
brew install android-commandlinetools
-
Create the Android SDK Directory
mkdir -p ~/Library/Android/sdk
-
Install Essential SDK Packages
sdkmanager --sdk_root=$HOME/Library/Android/sdk "platform-tools" "platforms;android-34" "build-tools;34.0.0" "cmdline-tools;latest"
-
Configure Environment Variables Add these to
~/.zshrc
or~/.bashrc
:export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$ANDROID_HOME/platform-tools:$PATH
-
Verify Installation
flutter doctor
Setting Up Android SDK (Windows)
-
Install Android Command-Line Tools
- Download from Android Developer
- Extract it to
C:\Android\cmdline-tools\latest
-
Install SDK Packages
cd C:\Android\cmdline-tools\latest\bin sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "cmdline-tools;latest"
-
Configure Environment Variables
- Add
C:\Android\platform-tools
andC:\Android\cmdline-tools\latest\bin
to Path.
- Add
-
Verify Installation
flutter doctor
Getting Started
This project is a great starting point for your Flutter application. If you're new to Flutter, check out these resources:
Additional Resources
For more help with Flutter development, visit the Flutter documentation, which provides tutorials, samples, and a full API reference.