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

Flutter utility classes, meant to be used with the home connect SDK

Home Connect Futter #

The Home Connect Flutter package contains utilities for oauth and storage management that can be used in your Flutter app.

Usage #

import 'package:homeconnect_flutter/homeconnect_flutter.dart';

Future<void> main() async {

  final prefs = await SharedPreferences.getInstance();
  final api =
      HomeConnectApi(Uri.parse(env["HOMECONNECT_URL"]!),
          credentials: HomeConnectClientCredentials(
            clientId: env["HOMECONNECT_CLIENT_ID"]!,
            redirectUri: env["HOMECONNECT_REDIRECT_URL"]!, // redirectUrl,
          ),
          authenticator: null,
          // pass storage to handle refresh tokens
          storage: SharedPreferencesHomeConnectAuthStorage(
            prefs,
          ),
      );
}

    // ... in you widget run the authorize function to start the oauth webview flow
    TextButton(
        onPressed: () async {
            await homeconnectApi.authenticate();
        },
    )