attachToTarget method Null safety

Future<SessionID> attachToTarget(
  1. TargetID targetId,
  2. {bool? flatten}

Attaches to the target with given id. flatten Enables "flat" access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See Returns: Id assigned to the session.


Future<SessionID> attachToTarget(TargetID targetId, {bool? flatten}) async {
  var result = await _client.send('Target.attachToTarget', {
    'targetId': targetId,
    if (flatten != null) 'flatten': flatten,
  return SessionID.fromJson(result['sessionId'] as String);