snapd 0.6.4 copy "snapd: ^0.6.4" to clipboard
snapd: ^0.6.4 copied to clipboard

PlatformLinux

Provides a client to access snapd, which allows you to manage, search and install snaps on a Linux system.

example/example.dart

// ignore_for_file: avoid_print

import 'dart:math';
import 'package:snapd/snapd.dart';

void main() async {
  final client = SnapdClient();
  await client.loadAuthorization();

  // Get the installed snaps.
  final snaps = await client.getSnaps();

  // Show basic information about installed snaps
  snaps.sort((a, b) => a.name.compareTo(b.name));
  final rows = [
    ['Name', 'Version', 'Rev', 'Tracking', 'Publisher'],
  ];
  for (final snap in snaps) {
    final publisher = snap.publisher?.username;
    rows.add(
      [
        snap.name,
        snap.version,
        snap.revision.toString(),
        snap.channel,
        publisher ?? '-',
      ],
    );
  }
  final columnWidths = [0, 0, 0, 0, 0];
  for (final row in rows) {
    for (var i = 0; i < columnWidths.length; i++) {
      columnWidths[i] = max(columnWidths[i], row[i].length + 1);
    }
  }
  for (final row in rows) {
    var line = '';
    for (var i = 0; i < columnWidths.length; i++) {
      line += row[i].padRight(columnWidths[i]);
    }
    print(line);
  }

  client.close();
}
11
likes
160
points
4.18k
downloads

Publisher

verified publishercanonical.com

Weekly Downloads

Provides a client to access snapd, which allows you to manage, search and install snaps on a Linux system.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

collection, freezed_annotation, json_annotation, meta, path, yaml

More

Packages that depend on snapd