cktap_transport 0.1.0 copy "cktap_transport: ^0.1.0" to clipboard
cktap_transport: ^0.1.0 copied to clipboard

Contains an interface for NFC operations when using the cktap_protocol plugin

NFC Transport Interface for the Coinkite Tap Protocol #

Provides an interface for the cktap_protocol plugin to perform NFC operations. Using a separate package allows the protocol to be decoupled from specific NFC plugins. It also means the user can provide their own implementation if desired.

Features #

  • Transport base class
  • TransportException base class

Getting Started #

Add one of the following dependencies to your pubspec.yaml:

dependencies:
  # Only when implementing your own transport class
  cktap_transport: ^0.0.1

  # An implementation using the nfc_manager plugin
  cktap_transport_nfc_manager: ^0.0.1

Usage #

Here's an example of implementing your own transport function:

import 'dart:typed_data';

import 'package:cktap_transport/cktap_transport.dart';

/// Implement the sendBytes function
class MyTransport extends Transport {
  @override
  Future<Uint8List> sendBytes(Uint8List bytes) async {
    try {
      // Send data here and return the response as bytes
    }
    catch (_) {
      throw const MyTransportException();
    }
  }
}

/// Create an exception
class MyTransportException implements TransportException {
  const MyTransportException();

  @override
  String toString() => "blah";
}

Additional Information #

Concrete implementations exist for the following plugins:

1
likes
140
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

Contains an interface for NFC operations when using the cktap_protocol plugin

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

app.mash.com

License

MIT (license)

Dependencies

flutter

More

Packages that depend on cktap_transport