Sample code for 30+ languages & platforms
Dart

Send HTTPS Get Without Waiting for the Response

See more REST Examples

This example demonstrates sending an HTTP GET request without waiting for the response.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final rest = CkRest();

  // Connect to the server using TLS
  final bAutoReconnect = false;
  try {
    rest.connect('example.com', 443, true, bAutoReconnect);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // Send a GET request to https://example.com/some/path 
  try {
    rest.sendReqNoBody('GET', '/some/path');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  // OK, the request was sent.
  // Close the connection.
  final maxWaitMs = 50;
  rest.disconnect(maxWaitMs);

  print('GET Request Sent.');
}