appstream 0.2.9 copy "appstream: ^0.2.9" to clipboard
appstream: ^0.2.9 copied to clipboard

PlatformLinux

A parser for Appstream data. This package allows Dart applications to access package metadata on Linux systems.

example/example.dart

import 'package:appstream/appstream.dart';

void main() async {
  var pool = AppstreamPool();
  await pool.load();
  for (var component in pool.components) {
    var type = {
          AppstreamComponentType.unknown: 'unknown',
          AppstreamComponentType.generic: 'generic',
          AppstreamComponentType.desktopApplication: 'desktop-application',
          AppstreamComponentType.consoleApplication: 'console-application',
          AppstreamComponentType.webApplication: 'web-application',
          AppstreamComponentType.addon: 'addon',
          AppstreamComponentType.font: 'font',
          AppstreamComponentType.codec: 'codec',
          AppstreamComponentType.inputMethod: 'input-method',
          AppstreamComponentType.firmware: 'firmware',
          AppstreamComponentType.driver: 'driver',
          AppstreamComponentType.localization: 'localization',
          AppstreamComponentType.service: 'service',
          AppstreamComponentType.repository: 'repository',
          AppstreamComponentType.operatingSystem: 'operating-system',
          AppstreamComponentType.iconTheme: 'icon-theme',
          AppstreamComponentType.runtime: 'runtime',
        }[component.type] ??
        'unknown';
    var name = component.name['C'] ?? '';
    var summary = component.summary['C'] ?? '';
    String? homepage;
    for (var url in component.urls) {
      if (url.type == AppstreamUrlType.homepage) {
        homepage = url.url;
        break;
      }
    }

    print('---');
    print('Identifier: ${component.id} [$type]');
    print('Name: $name');
    print('Summary: $summary');
    if (component.package != null) {
      print('Package: ${component.package}');
    }
    if (homepage != null) {
      print('Homepage: $homepage');
    }
  }
}
5
likes
160
pub points
65%
popularity

Publisher

verified publishercanonical.com

A parser for Appstream data. This package allows Dart applications to access package metadata on Linux systems.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

xml, yaml

More

Packages that depend on appstream