dexcom 0.1.1 dexcom: ^0.1.1 copied to clipboard
dexcom for Flutter allows you to use Dexcom Share to get your Dexcom CGM data, or anybody else's, to run your application. Includes time, reading, and trend.
About #
dexcom for Flutter allows you to use Dexcom Share to get your Dexcom CGM data, or anybody else's, to run your application. Includes time (in milliseconds since Enoch), reading, and trend. Use only your email and password to have access to all your glucose data! The username can be an email, username, or phone.
Features #
Very simple to use.
Usage #
Verifying: #
String username = "username";
String password = "password";
var dexcom = Dexcom(username, password);
List<dynamic>? response;
try {
// getReadings can be optionally set to false (the default is true) if you just want to check the session success
await dexcom.verifyLogin(username, password, [optional: getReadings]);
print("Verified account");
} catch (e) {
print("Unable to verify account: $e");
}
This logs the user into their account and gets their data. If both succeed (or if the session succeeds and getReadings is set to false), it will return
{"success": true, "error": "none"};
However, if it fails, it will return:
// If the session fails (wrong username/password):
{"success": false, "error": "session"}
// If the readings cannot be retrieved (not any readings in the last 48 hours may be a cause):
{"success": false, "error": "readings"}
Retrieving data: #
String username = "username";
String password = "password";
var dexcom = Dexcom(username, password);
List<dynamic>? response;
try {
response = await dexcom.getGlucoseReadings([optional: minutes, maxCount]);
print("Read data with dexcom: $dexcom");
} catch (e) {
print("Unable to read data with dexcom: $e");
}
if (response != null) {
print("Data received: $response");
return response;
else {
print("Data is null");
}
This actually retrieves the glucose readings from the user. If it fails, it automatically tries to recreate the session.
Additional information #
This package was based off of pydexcom for Python. I (and some help from ChatGPT) ported it to Flutter.
WARNING: THIS PACKAGE IS STILL IN BETA: IT MAY BE UNSTABLE! USE AT YOUR OWN RISK!