chilkat 11.6.1
chilkat: ^11.6.1 copied to clipboard
The Chilkat class library for Dart and Flutter: HTTP, REST, email (SMTP/POP3/IMAP), FTP, SFTP, SSH, zip, encryption, digital signatures, certificates, XML, JSON and more.
example/main.dart
// A small Dart CLI program using package:chilkat.
//
// dart run example/main.dart
import 'package:chilkat/chilkat.dart';
// The unlock code: any non-empty string starts the fully functional 30-day
// trial; a purchased code (or a trial-extension code) can be passed at build
// time with `dart run --define=CHILKAT_UNLOCK=<code> example/main.dart`.
const _unlockCode = String.fromEnvironment(
'CHILKAT_UNLOCK',
defaultValue: 'Anything for 30-day trial',
);
void main() {
Chilkat.unlockBundle(_unlockCode);
print('Chilkat ${Chilkat.version}');
// JSON: build, query, serialize.
final json = CkJsonObject()..emitCompact = false;
json.updateString('name', 'chilkat');
json.updateInt('answer', 42);
json.updateBool('flags.nested', true);
print(json.emit());
print('has name: ${json.hasMember('name')}');
// Hashing and encoding.
final crypt = CkCrypt2()
..hashAlgorithm = 'sha256'
..encodingMode = 'hex';
print('sha256("abc") = ${crypt.hashStringENC('abc')}');
// Failure handling: a status method throws a ChilkatException.
try {
CkJsonObject().load('{ not json');
} on ChilkatException catch (e) {
print(e); // CkJsonObject.load failed: <reason>
}
// HTTP (network): in a Flutter app, run this inside Isolate.run.
final http = CkHttp()..connectTimeout = 15;
try {
final page = http.quickGetStr('https://example.com/');
print('example.com: ${page.length} chars, status ${http.lastStatus}');
} on ChilkatException catch (e) {
print('HTTP failed: ${e.message}');
}
}