Skip to content

Dart SDK Quick Start

This article provides a quick start guide for using the Dart SDK for common operations. You will learn how to install the SDK, configure access credentials, and perform basic operations such as obtaining the latest upgrade information.

Notes

  • To make requests using the Dart SDK, you need to initialize a Client instance. This article creates a Client by loading default configurations. For more configuration options for the client, see Configure Client.

Prerequisites

  • Already registered an UpgradeLink account.
  • Obtained AccessKey and AccessSecret.
  • Configured URL application upgrade strategy.

Get Credentials

img.jpg

Install Dart

Check the Dart version using the following command:

shell
  dart --version
  • Add dependencies in pubspec.yaml:
yaml
  dependencies:
    upgradelink_api_dart: ^1.0.2

Quick Usage

The following sample program demonstrates how to initialize the Client and obtain the latest upgrade information for URL applications.

Get the Latest Upgrade Information for URL Applications

dart
import 'package:test/test.dart';
import 'package:upgradelink_api_dart/upgradelink_api_dart.dart';

void main() {
  group('A group of tests', () {
    setUp(() {});

    test('UrlUpgradeRequest Test', () async {
      final config = Config(
        accessKey: 'mui2W50H1j-OC4xD6PgQag',
        secretKey: 'PEbdHFGC0uO_Pch7XWBQTMsFRxKPQAM2565eP8LJ3gc',
        // protocol: 'HTTP',
        // endpoint: 'api.upgrade.toolsetlink.com',
      );
      final client = Client(config: config);

      final request = UrlUpgradeRequest(
        urlKey: 'uJ47NPeT7qjLa1gL3sVHqw',
        versionCode: 1,
        appointVersionCode: 0,
        devModelKey: '',
        devKey: '',
      );

      final response = await client.getUrlUpgrade(request);
      print(response.toString());
    });
    
  });
}

A successful return example is as follows:

UrlUpgradeResponse{code: 0, msg: Already the latest version, data: null}

toolsetlink@163.com