licenses property Null safety

Stream<LicenseEntry> licenses

Returns the licenses that have been registered.

Generating the list of licenses is expensive.

Implementation

static Stream<LicenseEntry> get licenses {
  if (_collectors == null) {
    return const Stream<LicenseEntry>.empty();
  }

  late final StreamController<LicenseEntry> controller;
  controller = StreamController<LicenseEntry>(
    onListen: () async {
      for (final LicenseEntryCollector collector in _collectors!) {
        await controller.addStream(collector());
      }
      await controller.close();
    },
  );
  return controller.stream;
}