Skip to content
Snippets Groups Projects
user avatar
pbad2 authored
b679016f
History

flutter_blue_app

A Flutter application that uses the flutter_bluetooth_serial package.

Table of Contents

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

  1. 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
  2. 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.

  3. Install Dependencies

    brew install cocoapods
    flutter doctor

    Follow any additional installation steps suggested by flutter doctor.

Installing Flutter on Windows

  1. Download Flutter

  2. Update Environment Variables

    • Open Edit environment variables from the Start menu.
    • Add C:\src\flutter\bin to the Path variable.
  3. Install Dependencies

    • Run:
      flutter doctor
    • Install any missing dependencies reported by flutter doctor.

Running the Application

  1. Add the Bluetooth Package Dependency
    In your project directory, run:

    flutter pub add flutter_bluetooth_serial:^0.4.0
  2. Get Dependencies
    Fetch the package:

    flutter pub get
  3. Create Necessary Files
    If needed, generate missing files:

    flutter create .
  4. Run the App
    Launch the application:

    flutter run

Building the APK

  1. Set Up the Android SDK
    Follow the setup instructions below for your operating system.

  2. Clean and Build
    Once the SDK is configured, run:

    flutter clean
    flutter build apk --release

Setting Up Android SDK (macOS)

  1. Install Android Command-Line Tools

    brew install android-commandlinetools
  2. Create the Android SDK Directory

    mkdir -p ~/Library/Android/sdk
  3. Install Essential SDK Packages

    sdkmanager --sdk_root=$HOME/Library/Android/sdk "platform-tools" "platforms;android-34" "build-tools;34.0.0" "cmdline-tools;latest"
  4. Configure Environment Variables Add these to ~/.zshrc or ~/.bashrc:

    export ANDROID_HOME=$HOME/Library/Android/sdk
    export PATH=$ANDROID_HOME/platform-tools:$PATH
  5. Verify Installation

    flutter doctor

Setting Up Android SDK (Windows)

  1. Install Android Command-Line Tools

  2. Install SDK Packages

    cd C:\Android\cmdline-tools\latest\bin
    sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "cmdline-tools;latest"
  3. Configure Environment Variables

    • Add C:\Android\platform-tools and C:\Android\cmdline-tools\latest\bin to Path.
  4. 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.