dp3t 0.1.1 copy "dp3t: ^0.1.1" to clipboard
dp3t: ^0.1.1 copied to clipboard

Exposes the DP3T SDK API in Flutter.

flutter-dp3t #

Exposes the DP3T SDK API in Flutter.

Heavily inspired by this React-native homologous library.

Status #

Pre-alpha. Requires some manual setup to work. Not tested yet. Can change without notice. PRs are welcome!

The iOS SDK and Android SDK themselves are in alpha state.

Install #

We will publish this package in the future, but for now, you must install it locally:

$ git clone git@github.com:pgte/flutter-dp3t.git

Add dependencies.dp3t to your pubspec.yaml file:

dependencies:
  dp3t:
    path: <path to the locally-installed flutter-dp3t package>

Minimum deployment targets: #

  • iOS 11.0
  • Android: Minimum SDK version: 23. Target version: 29

Initialization #

Both iOS and Android require some native code to initialize the DP3T SDK. Here is an example from the embedded example app:

For these both, you will have to declare the dependency on the original SDK.

Permissions #

Both in iOS and Android you need to declare the permissions required for DP3T to work. Please look for them in the original SDKs:

Example app: #

See the included example app.

To run the example app from the terminal:

$ cd example
$ flutter run

Known issues in the SDK #

  • The error handling differs a lot between the iOS and the Andriod versions of the DP3T SDK. iOS halts the app on almost all the errors, while the Andriod version seems to handle them more properly.
  • iOS needs initializing after resetting, while the Android versions does not.
  • It doesn't look like the jwtPublicKey initialization argument is being used in the Android version.

Use #

For the semantic of each API call, please consult the official DP3T documentation.

Import:

import 'package:dp3t/dp3t.dart';

API #

Future<void> initializeManually({String appId, String reportBaseUrl, String bucketBaseUrl, String jwtPublicKey}) #

Example:

await Dp3t.initializeManually({
  appId: "some app id",
  reportBaseUrl: "http://example.com",
  bucketBaseUrl: "http://example.com",
  jwtPublicKey: jwtPublicKey}) // Base64-encoded JWT

Future<void> initializeWithDiscovery({ String appId, bool dev }) #

Example:

Dp3t.initializeWithDiscovery({
  appId: "some app id", // used for discovery
  dev: true // true if in the development environment
})

Future<void> reset() #

Example:

await Dp3t.reset()

Future<void> startTracing() #

Example:

await Dp3t.startTracing()

Future<void> stopTracing() #

Example:

await Dp3t.stopTracing()

Future<Map> status() #

Example:

status = await Dp3t.status()

The status map is an object with the following shape:

{
  "tracingState",
  "numberOfHandshakes",
  "numberOfContacts",
  "healthStatus",
  "errors": Array<String>,
  "nativeErrors": Array<String>,
  "matchedContacts": Array<
    {
      "id",
      "reportDate"
    }
  >,
  "lastSyncDate",
  "nativeErrorArg",
  "nativeStatusArg"
}

Future<void> iWasExposed({DateTime onset, String authentication}) #

Example:

await iWasExposed({onset: DateTime.now(), authentication: authenticationString })

License #

See LICENSE

1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Exposes the DP3T SDK API in Flutter.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on dp3t