Created
March 15, 2022 11:49
-
-
Save stevehobbsdev/0edc1f1614563397fda69f6f6e6f9d29 to your computer and use it in GitHub Desktop.
Dart: Api 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPA JS-like | |
// Tries to implement pattern like: https://dart.academy/creational-design-patterns-for-dart-and-flutter-builder/ | |
void main() { | |
final client = Auth0WebClient( | |
domain: 'test', clientId: 'test', audience: 'test', issuer: 'test'); | |
client.loginWithRedirect(); | |
} | |
class Auth0WebClient { | |
final String domain; | |
final String clientId; | |
final String? audience; | |
final String? issuer; | |
Auth0WebClient( | |
{required this.domain, | |
required this.clientId, | |
this.issuer, | |
this.audience}); | |
loginWithRedirect() { | |
// .. // | |
} | |
getAccessToken() { | |
// .. // | |
} | |
logout() { | |
// .. // | |
} | |
Auth0WebClient copyWith({String? audience, String? issuer}) { | |
return Auth0WebClient( | |
domain: domain, | |
clientId: clientId, | |
audience: audience ?? this.audience, | |
issuer: issuer ?? this.issuer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment