connect method Null safety

Future<bool> connect(
  1. [ResponseCallback<bool>? callback]
)

Connect to the device, and call the callback with the result.

Args: callback (ResponseCallback): A callback function that will be called when the connection is established.

Implementation

Future<bool> connect([ResponseCallback<bool>? callback]) async {
  final resp = await MotorFlutterPlatform.instance.connect();
  if (callback != null) {
    callback(resp);
  }
  connected.value = resp;
  return resp;
}