snapd 0.4.14 copy "snapd: ^0.4.14" to clipboard
snapd: ^0.4.14 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

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

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

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

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

  client.close();
}
9
likes
140
pub points
69%
popularity

Publisher

verified publishercanonical.com

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, json_annotation, meta, path

More

Packages that depend on snapd