jspaste 0.2.0 copy "jspaste: ^0.2.0" to clipboard
jspaste: ^0.2.0 copied to clipboard

A future-based null-safe modern Dart library to interact with the JSPaste API.

example/main.dart

import 'package:jspaste/jspaste.dart';

void main() async {
  // Create a new JSPaste client.
  final apiClient = JSPasteClient();

  // Create a new document.
  Document document = Document('Hello, World!',
      password: 'password', expiresAt: DateTime.now().add(Duration(days: 1)));

  // Publish the document.
  document = await apiClient.publishDocument(document);

  // Print the document url.
  print(document.url);

  // Update the document text.
  await document.update('Hello, World! This is an edit.');

  // Get a document.
  try {
    final document =
        await apiClient.getDocument('document-key', password: 'password');
    print(document.text);

    // Update the document text.
    document.secret = 'aaaaa-bbbbb-ccccc-ddddd';
    await document.update('Hello, World! This is an edit.');
  } catch (e) {
    print(e);
  }

  // Unpublish the document.
  await document.unpublish();
}
3
likes
160
points
50
downloads

Publisher

verified publishernulkode.dev

Weekly Downloads

A future-based null-safe modern Dart library to interact with the JSPaste API.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http, meta

More

Packages that depend on jspaste