FitbitConnector class

FitbitConnector is a class that is in charge of managing the connection authorization between the app and Fitbit APIs. In details, it can authorize the app thus retaining the access and refresh tokens (see FitbitConnector.authorize for more details), refresh the access token if needed (see FitbitConnector.refreshToken for more details), unauthorize the app (see FitbitConnector.unauthorize for more details), and check for the access token status (see FitbitConnector.isTokenValid for more details).

Constructors

FitbitConnector()
Public factory constructor of FitbitConnector.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

authorize({required String clientID, required String clientSecret, required String redirectUri, required String callbackUrlScheme, List<FitbitAuthScope> scopeList = const [FitbitAuthScope.ACTIVITY, FitbitAuthScope.CARDIO_FITNESS, FitbitAuthScope.HEART_RATE, FitbitAuthScope.LOCATION, FitbitAuthScope.NUTRITION, FitbitAuthScope.OXYGEN_SATURATION, FitbitAuthScope.PROFILE, FitbitAuthScope.RESPIRATORY_RATE, FitbitAuthScope.SETTINGS, FitbitAuthScope.SLEEP, FitbitAuthScope.SOCIAL, FitbitAuthScope.TEMPERATURE], int expiresIn = 28800}) Future<FitbitCredentials?>
Method that implements the OAuth 2.0 protocol and gets the access and refresh tokens from Fitbit APIs.
isTokenValid({required FitbitCredentials fitbitCredentials}) FutureOr<bool>
Method that checks if the current token is still valid to be used by the Fitbit APIs OAuth or it is expired.
refreshToken({required String clientID, required String clientSecret, required FitbitCredentials fitbitCredentials}) Future<FitbitCredentials>
Method that refreshes the Fitbit access token and returns the new, refreshed FitbitCredentials.
unauthorize({required String clientID, required String clientSecret, required FitbitCredentials fitbitCredentials}) Future<void>
Method that revokes the current access tokens.