printeastwoodcz / flutter_credential_plugin

Credential picker for Google Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter_credential_picker

Credential picker for Google Service

You can get your phone number without adding a phone permission to your app. Also you can get email or account info directly from your phone.

Supported platforms

This picker is Android only

Getting Started

add plugin to your pubspec.yaml

flutter_credential_picker: ^0.0.1

Implementation

Get Phone number

CredentialPicker.pickPhoneNumber().then((value)=> setState((){
    _credential = value
}));

or

try{
    final result = CredentialPicker.pickPhoneNumber();
    setState((){
        _credential = result
    }
} on NotFoundException catch(_){
    ...
}
} on AccountsNotFound catch(_){
    ...
}
} on NotSupportedPlatform catch(_){
    ...
}
} on MissingGoogleService catch(_){
    ...
}

Get Email address

CredentialPicker.pickEmail().then((value)=> setState((){
    _credential = value
}));

or

try{
    final result = CredentialPicker.pickEmail();
    setState((){
        _credential = result
    }
} on NotFoundException catch(_){
    ...
}
} on AccountsNotFound catch(_){
    ...
}
} on NotSupportedPlatform catch(_){
    ...
}
} on MissingGoogleService catch(_){
    ...
}

Get Account

You can specify account types query, default value is AccountType.google only

/// default accountTypes is [AccountType.google]
CredentialPicker.pickGoogleAccount().then((value)=> setState((){
    _credential = value
}));
/// or you can add more supported account types as list
CredentialPicker.pickGoogleAccount(accountTypes: [
                              AccountType.google,
                              AccountType.facebook,
                              AccountType.twitter,
                              AccountType.microsoft
                            ]).then((value)=> setState((){
    _credential = value
}));

or

try{
    final result = CredentialPicker.pickGoogleAccount(accountTypes: [
                              AccountType.google,
                              AccountType.facebook,
                              AccountType.twitter,
                              AccountType.microsoft
                            ]);
    setState((){
        _credential = result
    }
} on NotFoundException catch(_){
    ...
}
} on AccountsNotFound catch(_){
    ...
}
} on NotSupportedPlatform catch(_){
    ...
}
} on MissingGoogleService catch(_){
    ...
}

About

Credential picker for Google Service

License:MIT License


Languages

Language:Dart 57.5%Language:Kotlin 28.7%Language:Ruby 6.6%Language:Swift 4.9%Language:Objective-C 2.4%