nuget

Last updated:

0 purchases

nuget Image
nuget Images
Add to Cart

Description:

nuget

A Dart package that allows interaction with the
NuGet Server API. This package provides easy access to
the NuGet Server API, allowing you to perform various operations such as
querying package information, downloading package content, fetching package
metadata, and more.
Features #

Autocomplete package IDs
Download package content (.nupkg)
Download package manifest (.nuspec)
Get all package metadata (all versions)
Get latest package version
Get package metadata (specific version)
Get package versions
Check if a package exists
Search packages

Usage #
Autocomplete package IDs #
import 'package:nuget/nuget.dart';

void main() async {
// Create an instance of NuGetClient.
final client = NuGetClient();

const query = 'win32';
final response = await client.autocompletePackageIds(query);
print('The `$query` query returned ${response.totalHits} hits. '
'Here are the first 20 results:');
for (final packageId in response.data) {
print(' - $packageId');
}

// Close the client when it's no longer needed.
client.close();
}
copied to clipboard
Download package content (.nupkg) #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
const version = '13.0.3';
final content =
await client.downloadPackageContent(packageId, version: version);
print('`$packageId` ($version) package size: ${content.length} bytes');

client.close();
}
copied to clipboard
Download package manifest (.nuspec) #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
const version = '13.0.3';
final manifest =
await client.downloadPackageManifest(packageId, version: version);
print('`$packageId` ($version) manifest size: ${manifest.length} bytes');

client.close();
}
copied to clipboard
Get all package metadata (all versions) #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
final allMetadata = await client.getAllPackageMetadata(packageId);
print('`$packageId` metadata of first three versions:');
for (final metadata in allMetadata.take(3)) {
print(' - Version: ${metadata.version}');
print(' - Description: ${metadata.description}');
print(' - Author(s): ${metadata.authors}');
print('');
}

client.close();
}
copied to clipboard
Get latest package version #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
final latestVersion = await client.getLatestPackageVersion(packageId);
print('`$packageId` latest version: $latestVersion');

client.close();
}
copied to clipboard
Get package metadata (specific version) #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
const version = '13.0.3';
final metadata = await client.getPackageMetadata(packageId, version: version);
print('`$packageId` ($version) metadata:');
print(' - Version: ${metadata.version}');
print(' - Description: ${metadata.description}');
print(' - Author(s): ${metadata.authors}');

client.close();
}
copied to clipboard
Get package versions #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
final versions = await client.getPackageVersions(packageId);
print('`$packageId` has ${versions.length} versions:');
for (final version in versions) {
print(' - $version');
}

client.close();
}
copied to clipboard
Check if a package exists #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const packageId = 'Newtonsoft.Json';
final exists = await client.packageExists(packageId);
print('`$packageId` exists: $exists');

client.close();
}
copied to clipboard
Search packages #
import 'package:nuget/nuget.dart';

void main() async {
final client = NuGetClient();

const query = 'win32';
final searchResponse = await client.searchPackages(query);
print('The `$query` query returned ${searchResponse.totalHits} hits. Here '
'are the first 20 results:');
for (final package in searchResponse.data) {
print(' - ${package.packageId} (${package.version})');
}

client.close();
}
copied to clipboard
Feature requests and bugs #
Please file feature requests and bugs at the
issue tracker.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.