install method

Future<String> install(
  1. String name, {
  2. String? channel,
  3. String? revision,
  4. bool classic = false,
  5. bool dangerous = false,
  6. bool devmode = false,
  7. bool jailmode = false,
})

Installs the snap with the given name. Returns the change ID for this operation, use getChange to get the status of this operation.

Implementation

Future<String> install(String name,
    {String? channel,
    String? revision,
    bool classic = false,
    bool dangerous = false,
    bool devmode = false,
    bool jailmode = false}) async {
  var request = <String, dynamic>{'action': 'install'};
  if (channel != null) {
    request['channel'] = channel;
  }
  if (revision != null) {
    request['revision'] = revision;
  }
  if (classic) {
    request['classic'] = true;
  }
  if (dangerous) {
    request['dangerous'] = true;
  }
  if (devmode) {
    request['devmode'] = true;
  }
  if (jailmode) {
    request['jailmode'] = true;
  }
  var encodedName = Uri.encodeComponent(name);
  return await _postAsync('/v2/snaps/$encodedName', request);
}