Create a Flutter Project

The supported platform is iOS and Android, and the language is kotlin and swift, respectively, to create a project.

flutter create --platforms=android,ios -i swift -a kotlin your_app_name

Project setup

Copy of the THETA client

Copy to the project that created the Flutter plugin package for THETA Client.

demo-flutter is placed in demo-flutter/packages/theta_client_flutter under the project.

Flutter plug-in setting

Added theta_client_flutter copied to dependencies of pubspec.yaml.

dependencies:
  flutter:
    sdk: flutter
  theta_client_flutter:
    path: ./packages/theta_client_flutter

Android setting

Set the minimum SDK version to 26 or higher

    MinSdkVersion 26

iOS setting

Set iOS Deployment Target to 15 or higher

Advance preparation

Connect the wireless LAN between THETA and the smartphone that runs on the application using this THETA Client.

Initialize THETA Client

import 'package:theta_client_flutter/theta_client_flutter.dart';

final _thetaClientFlutterPlugin = ThetaClientFlutter();

_thetaClientFlutterPlugin.initialize()
  .then((value) {
    // success
  })
  .onError((error, stackTrace) {
    // handle error
  });

OR

_thetaClientFlutterPlugin.initialize('http://<IP address>:<port number>')
  .then((value) {
    // success
  })
  .onError((error, stackTrace) {
    // handle error
  });