Sample code for 30+ languages & platforms
Dart

Example: Http.QuickGetStr method

Demonstrates the QuickGetStr method.

Chilkat Dart Downloads

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

void main() {
  final http = CkHttp();

  // Keep the response body if there's an error.
  http.keepResponseBody = true;

  // Send the HTTP GET and return the content in a string.
  final String str;
  try {
    str = http.quickGetStr('https://www.chilkatsoft.com/helloWorld.json');
  } on ChilkatException catch (e) {
    if (http.lastStatus == 0) {
      // Communications error.  We did not get a response.
      print(e.lastErrorText);
    } else {
      print('Response status code: ${http.lastStatus}');
      print('Response body error text:');
      print(http.lastResponseBody);
    }

    return;
  }

  print(str);
  print('Success');
}