Logto helps you quickly focus on everything after signing in.

Logto Flutter SDKs

Build Status

Logto's flutter SDK for native apps.

Installation

flutter pub get logto_dart_sdk

Products

NameDescription
logto_coreCore SDK is used for generation dart project with basic API and util method provided.
logto_clientClient SDK for flutter native apps. Built based on logto_core with user sign-in interaction flow integrated

Logto Client

Basic Use

import 'package:logto_dart_sdk/logto_dart_sdk.dart';

// ...
late LogtoClient logtoClient;

void _init() async  {
  logtoClient = LogtoClient(
    config: config, // LogtoConfig
    httpClient: http.Client(), // Optional http client
  );
}

void signIn() async {
  await logtoClient.signIn(redirectUri);
}

void signOut() async {
  await logtoClient.signOut();
}

Class LogtoConfig

Properties

nametypedescription
appIdStringYour appId generate from Logto's admin console
appSecretString?App Secret generated along with the appId. Optional for native apps.
endpointStringYour logto server endpoint. e.g. https://logto.dev
scopesList<String>?List all the permission scopes your app will request for. You may define and find it through Logto's admin console.
resourcesList<String>?List all the (resource indicators)https://docs.logto.io/docs/references/resources/ you app may request for access. You may define and find it through Logto's admin console.

Class LogtoClient

Properties

nametypedescription
configfinal LogtoConfigLogto Config used to init Logto Client
idTokenread-only Future<String?>idToken returned after success authentication
isAuthenticatedread-only Future<bool>Is Authenticated status
idTokenClaimsread-only Future<OpenIdClaims?>Decoded idToken claims including basic userinfo
loadingread-only boolGlobal API loading status

Methods

nametypedescription
getAccessToken({String? resource}) -> Future<AccessToken>Request for an api resource specific access token for authorization
signIn(String? redirectUri) -> Future<void>Init user sign-in flow
signOut() -> Future<void>Sign-out

Libraries

logto_client
logto_core
logto_dart_sdk