setDeviceName method

Future<bool?> setDeviceName(
  1. String deviceName
)

Requests a change of the name of the connected device.

Maximum size is 22 characters. Returns true if the request was successfully made, false otherwise.

Implementation

Future<bool?> setDeviceName(String deviceName) async {
  assert(deviceName.isNotEmpty && deviceName.length < 22,
      'The device name must be more that zero and less than 22 characters long.');
  if (!connected) {
    throw ESenseException('Not connected to any eSense device.');
  }
  return await _eSenseManagerMethodChannel.invokeMethod(
          'setDeviceName', <String, dynamic>{'deviceName': deviceName}) ??
      false;
}