---
product: Chilkat
product_version: 11.7.0
language: dart
language_label: Dart
document: language guide
---
> Chilkat 11.7.0 · language=dart · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/dart/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/dart/classes/<Class>.md`

# Chilkat for Dart — language guide — v11.7.0

## 1. Which Chilkat binding this is

This is the **Chilkat package for Dart and Flutter** (`chilkat` on pub.dev): `import 'package:chilkat/chilkat.dart'`, classes `CkHttp`, `CkZip`, `CkBinData`, … with Dart properties and camelCase methods (`http.quickGetStr(url)`). Failures are reported by **throwing `ChilkatException`** — this binding is unlike most other Chilkat bindings in that respect. The prebuilt native library for Android, iOS, macOS, Windows or Linux is downloaded at build time.

## 2. Install and requirements

```
dart pub add chilkat        # or: flutter pub add chilkat
```

Details: [https://www.chilkatsoft.com/dart.asp](https://www.chilkatsoft.com/dart.asp).

## 3. Unlocking, object creation, lifetime and errors

Generated from the reference documentation for this binding:

**Object Creation**

```dart
// pubspec.yaml:
//     dependencies:
//       chilkat: ^11.7.0

import 'package:chilkat/chilkat.dart';

// Once per process, before any other Chilkat call:
Chilkat.unlockBundle('Anything for 30-day trial');   // shorthand for CkGlobal().unlockBundle(..)

final global = CkGlobal();
// ... the native object is released when `global` is garbage collected, or now with global.dispose().
```

`CkGlobal CkGlobal()`

Creates the underlying native Chilkat object. Use a `CkGlobal` only from the isolate that created it: Chilkat objects cannot be sent between isolates. Every call is synchronous; in a Flutter app, run long operations (network, large files) inside `Isolate.run`, creating the Chilkat objects inside the isolate.

`void dispose()`

Releases the native object immediately instead of waiting for garbage collection (useful for a large `CkBinData` or an open socket). Calling it more than once is harmless; any other use of the object afterwards throws a `StateError`. `isDisposed` tells whether it has been called.

**Errors**

A method that can fail throws a `ChilkatException`: a method whose only outcome is success or failure returns `void` and throws on failure; a method producing a `String` or an object returns it and throws where Chilkat would have returned null. The exception carries the object's `LastErrorText` at the time of the failure (`lastErrorText`), the class and method names (`className`, `methodName`) and a one-line `message`. Properties never throw, and methods that answer a question (`has...`, `is...`, ...) return a plain `bool`.

```dart
try {
  global.someMethod(...);
} on ChilkatException catch (e) {
  print(e);                // CkGlobal.someMethod failed: <reason>
  print(e.lastErrorText);  // the full Chilkat log of the failed call
}
```

## 4. Error model

A method that can fail **throws `ChilkatException`**: a method whose only outcome is success or failure returns `void` and throws on failure; a method producing a `String` or an object returns it and throws where Chilkat would otherwise have returned null. The exception carries `lastErrorText` (the full diagnostic), `className`, `methodName` and a one-line `message`. Properties never throw; methods that answer a question (`has…`, `is…`) return a plain `bool`. The note under each method on the class page restates this per method.

Literals in Dart: true is `true`, false is `false`, null/none is `null`.

## 5. Strings, bytes and encodings

- Strings are Dart `String`; a `charset` argument names the encoding of the *bytes* being produced or read.
- Binary data is `Uint8List` in and out; larger or reusable data goes through `CkBinData` (`…Bd` methods) and text through `CkStringBuilder` (`…Sb` methods).
- Methods with `2`/`3` suffixes or `quick…` prefixes are distinct members, not overloads.

## 6. Object lifetime and threading

The native object is released when the Dart object is garbage collected, or immediately with `dispose()` (any later use throws `StateError`). Use an object only from the isolate that created it; in a Flutter app run long operations inside `Isolate.run`, creating the Chilkat objects inside the isolate.

A Chilkat object may be used from any thread, but **one object must not be used by two threads at the same time**: create one object per thread or protect it with a lock. Objects are independent — there is no shared global state other than the unlock flag and the few `Global` settings.

## 7. Progress callbacks and async

Progress events are supported through the class's event callbacks (see the "Events and callbacks" section of a class page). Every call is synchronous; for responsiveness in Flutter run it in an isolate rather than relying on `*Async` methods.

## 8. Common mistakes an AI makes with this binding

1. Checking a return value for `false`/`null` instead of catching `ChilkatException` — this binding throws.
2. Using PascalCase member names from other bindings (`QuickGetStr`, `LastErrorText`); Dart members are camelCase (`quickGetStr`, `lastErrorText`).
3. Passing a Chilkat object between isolates.
4. Omitting `Global.UnlockBundle` (the program runs in trial mode and stops working after 30 days).
5. Inventing members by analogy with other libraries. If a member is not on the class page, it does not exist — look it up rather than guessing.
6. Using deprecated members that older examples still show. The class page lists each one with its replacement; `deprecated.md` lists them all.
7. Ignoring the failure path. Every Chilkat method reports failure (see each method's note); `LastErrorText` says why, and printing it is the first debugging step.
8. Using one Chilkat object from two threads at the same time. Create one object per thread, or protect it with a lock.

## 9. Instructions block for coding agents

Paste into `CLAUDE.md`, `.cursor/rules`, or Copilot instructions:

```
This project uses Chilkat 11.7.0 from Dart (package chilkat on pub.dev; classes CkHttp, CkZip, ...; camelCase members).
- Reference: https://www.chilkatsoft.com/ai-docs/v/11.7.0/dart/ — read guide.md once, then classes/<Class>.md for each class used.
- Call Chilkat.unlockBundle(...) once at startup.
- Failures throw ChilkatException: catch it and print e.lastErrorText.
- Never use a member that is not on the class page; never use members listed as deprecated.
```

## 10. Classes

[Class index for Dart](https://www.chilkatsoft.com/ai-docs/v/11.7.0/dart/index.md)
