前提条件(iOSの場合)
https://help.apple.com/developer-account/#/dev21218dfd6
Hotspot Configuration
という機能を利用しますが、上記リンクに記載されている通り、ADP
又はEnterprise
を利用します。そのためAppleに毎年約1万円という学生の方(私)にとってとても痛い契約をしていない方は利用できませんのでご注意ください。
検証環境
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1)
[✓] VS Code (version 1.67.2)
[✓] HTTP Host Availability
利用パッケージ
次のパッケージを利用します。(随筆時点はv0.3.16)
iOSの場合
XCodeでプロジェクトを開き、
Runner
> Signing & Capabilities
> Allの隣の+
を選択し、HotSpot Configuration
を選択して有効にします。
コード
WiFiForIoTPlugin.connect(/*SSID*/,
password: /*password*/,
security: /*NetworkSecurity型のセキュリティ*/,
joinOnce: /*1度きりの接続かどうか*/);
詳しいドキュメントはこちらからどうぞ。
https://pub.dev/documentation/wifi_iot/latest/wifi_iot/WiFiForIoTPlugin-class.html