heroes 0.1.0

Flutter Android

This package lets you know whether you have met with a potentially active case.

Heroes #

This package was built to help detect and contain the spread of Covid-19.

It has a decentralized design that fully respects privacy and doesn't upload any encounter data to the cloud.

You can read more information about this project here: https://devpost.com/software/heroes-maprq6

Installing #

1. Import the package #

Step 1: Add this to your package's pubspec.yaml file:

  heroes: ^0.0.2

Step 2: Install it. You can install it from the command line:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Step 3: Import it. Now in your Dart code, you can use:

import 'package:heroes/heroes.dart';

2. Android: Add the following permissions to your AndroidManifest.xml #

They are required to use NearbyConnections.

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.NFC" />

Since ACCESS_FINE_LOCATION is considered a dangerous system permission, in addition to adding it to your manifest, you must request this permission at runtime. The Heroes package will request this permission during its start() method if they have not been granted yet.

How to use #

This is a basic set up:

final heroes = Heroes();
heroes.setLogCallback(myLogFunction); // Optionally, you can add a callback function that takes a String parameter to aid in development. `print` works fine.
await heroes.setAPIkey("my-api-key"); // Because this package makes use of our private servers, you need a key to use it. Contact us to request it.
bool userIsRegistered = await heroes.userIsRegistered; // Check whether the user is already registered.
if (!userIsRegistered) {
  // Handle user registration
  userIsRegistered = await heroes.registerUser("user's-invitation-code"); // This method returns whether or not it was successful in registering the user.
if (userIsRegistered) {
  await heroes.start(); // This method initializes the detection and handling of encounters.

  // Add onExposureDetected callback
  heroes.onExposureDetected = myOnExposureDetectedFunction; // This function will be called when the package detects that this device made contact with infected devices. This information is not available immediately, but up to 24 hours after a case has been confirmed.

  //You can also ask for this information at any time:
  final exposureData = heroes.getExposureData();
pub points

This package lets you know whether you have met with a potentially active case.



API reference






background_fetch, equatable, flutter, geolocator, http, intl, location, meta, nearby_connections, path_provider, shared_preferences


Packages that depend on heroes