cure 0.1.0-nullsafety.0 copy "cure: ^0.1.0-nullsafety.0" to clipboard
cure: ^0.1.0-nullsafety.0 copied to clipboard

A library for Dart developers which contains some useful tools and extensions: Signalr, MessagePack, CRC, HTTP, EventSource, WebSocket, etc.

example/README.md

  1. convert
import 'package:cure/convert.dart';
import 'package:cure/core.dart';

void main() {
  // MessagePack
  var object = Timestamp.utc(1970);
  final data = messagePack.encode(object);
  print(data); // [214, 255, 0, 0, 0, 0]
  object = messagePack.decode(data) as Timestamp;
  print(object); // Timestamp(0, 0)
}

  1. crypto
import 'dart:convert';

import 'package:cure/crypto.dart';

void main() {
  final crc = CRC.crc16MODBUS();
  final data = utf8.encode('123456789');
  final value = crc.calculate(data);
  print(value);
  final result = crc.verify(data, value);
  print(result);
}

  1. http
import 'package:cure/http.dart';

void main() async {
  var client = Client();
  try {
    final response = await client.getAsync('url');
    print('${response.statusCode}: ${response.content}');
  } catch (e) {
    print(e);
  } finally {
    client.close();
  }
}

  1. signalr
import 'package:cure/signalr.dart';

void main() async {
  final builder = HubConnectionBuilder()
    ..url = 'url'
    ..logLevel = LogLevel.information
    ..reconnect = true;
  final connection = builder.build();
  connection.on('send', (args) => print(args));
  await connection.startAsync();
  await connection.sendAsync('send', ['Hello', 123]);
  final obj = await connection.invokeAsync('send', ['Hello', 'World']);
  print(obj);
}

5
likes
140
pub points
68%
popularity

Publisher

verified publisheryanshouwang.dev

A library for Dart developers which contains some useful tools and extensions: Signalr, MessagePack, CRC, HTTP, EventSource, WebSocket, etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

ansicolor, meta, pedantic, string_scanner, tuple

More

Packages that depend on cure