connect method

Future<bool> connect()

Initiates a connection scanning procedure.

The phone will first scan for the device with the given deviceName. Then, if found, it will try to connect. Different ConnectionEvent events of type

are fired at different stages of the procedure.

Returns true if scanning is started is successful, ´false` otherwise.

Always make sure to disconnect the device when you don’t need it anymore. Failing to do so can drain the battery significantly.

Implementation

Future<bool> connect() async {
  _eventStream = null;
  _sensorStream = null;

  return await _eSenseManagerMethodChannel.invokeMethod<bool?>(
          'connect', <String, dynamic>{'name': deviceName}) ??
      false;
}