Altogic Dart
Altogic Dart is a Dart client for the Altogic Client Library. It provides access to all the functionality of the Altogic Client Library.
This package includes some Flutter dependencies in addition to the altogic_dart package.
Additional Functionalities
Default Local Storage
AltogicClient
needs a local storage implementation to hold session and user information. This package provides a default
local storage implementation that uses the shared_preferences package.
To create AltogicClient
with default client, have to use this package's createClient method.
import 'package:altogic_dart_flutter/altogic_dart_flutter.dart';
final altogic = createClient(
'your env url',
'your client key'
);
Auto Open Sign In With Provider URLs
AltogicClient can open sign in with provider URLs automatically. To open sign in with provider URLs automatically, have to
use AuthManager.signInWithProviderFlutter
method.
altogic.auth.signInWithProviderFlutter('google');
signInWithProviderFlutter
returns a Future
that resolves to true
if the sign in with provider URL is opened.
Handle Sign In With Provider Callbacks
AuthManager.handleProviderRedirect
method can be used to handle sign in with provider callbacks URLs.
// handle url in onGenerateInitialRoutes in Web, uni_links package and deep linking in mobile
var userSession = await altogic.auth.handleProviderRedirect(url);
if (userSession != null) {
// Sign in with provider is successful
}
handleProviderRedirect
returns a Future<UserSessionResult>
.