release method

void release(
  1. String deviceId
)

Frees deviceId for other agents when this process holds the claim; a claim another process holds is left alone.

Implementation

void release(String deviceId) {
  try {
    final f = _file(deviceId);
    final j = jsonDecode(f.readAsStringSync()) as Map<String, Object?>;
    if ((j['pid'] as num).toInt() == ownPid) f.deleteSync();
  } on Object {
    // no claim file means nothing to free
  }
}