0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

macOSでflutter_blue_plusのサンプルアプリを動かす

Last updated at Posted at 2023-10-22

macOSでflutter_blue_plusのサンプルアプリを動かす

FlutterのパッケージでiOS, Android, macOSでBLEのプラグインflutter_blue_plusを見つけたので使ってみました。
macOS向けの記事がなかったので、備忘録的な記録です。

ケースによりライセンスが必要になっていました。(2025/11/28時点)

  • Free use: For individuals, organizations with fewer than 50 employees, nonprofits, and educational institutions.
  • Commercial use: For-profit organizations with 50 or more employees must purchase a Commercial License. This license grants lifetime use, covers all FlutterBluePlus packages, and includes 365 days of updates.

アプリ起動

Flutterの開発環境は構築済みの前提です。
flutter_blue_plusリポジトリをクローンして、exampleアプリを起動します。

git clone git@github.com:boskokg/flutter_blue_plus.git
cd flutter_blue_plus/example
flutter pub get
flutter run -d macos

起動すると以下のようなBLEデバイスのスキャン画面が表示されます。

スクリーンショット 2023-10-22 14.14.39.png

実際にBLE接続して、CharacteristicのREADやWRITEも動作確認できました。

スクリーンショット 2023-10-22 14.15.26.png

BLE Adapter not availableと表示される時

flutter_blue_plusをパッケージとして使用する場合、bluetoothのEntitlementsを設定する必要があります。

Runner/DebugProfile.entitlementsとRelease.entitlementsに以下を追記すると解消されます。

<key>com.apple.security.device.bluetooth</key>
<true/>

引用元: https://github.com/pauldemarco/flutter_blue/issues/788#issuecomment-796831258

まとめ

macOSでも使用できるBLEパッケージで、BLEの基本的な動作は実現できることがわかりました。
macOSでBLEの動作確認できるアプリがないので、サンプルアプリを改良してmacOS向けアプリを作ってみたいです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?