acquire static method

Acquire a handle to the license list. First call decodes the blob; subsequent calls share the same decoded list. Safe to call concurrently.

Call OssLicensesHandle.close when done.

Implementation

static Future<OssLicensesHandle> acquire() async {
  _refCount++;
  _loading ??= _decode();
  try {
    final list = await _loading!;
    return OssLicensesHandle._(list);
  } catch (_) {
    _refCount--;
    if (_refCount == 0) _loading = null;
    rethrow;
  }
}