flutterdartcredentials

Credential Management API Flutter


How to implement Credential Management API in Flutter?

I want save login Credential in Google. How to invoke Credential Management API in browser?


Solution

  • Use autofillgroup to save your Credential in browser and sync with your google account.

    return Form(
          
            key: _mobileKey,
            child: AutofillGroup(
                child: FocusScope(
                    child: Column(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                  TextFormField(
                    controller: mobileController,
                    autofillHints: const [AutofillHints.telephoneNumber],
    
                    autofocus: true,
                    maxLength: 10,
                    inputFormatters: [
                      FilteringTextInputFormatter.digitsOnly,
                      LengthLimitingTextInputFormatter(10),
                    ],
                    textInputAction: TextInputAction.next,
                    keyboardType: TextInputType.phone,
                    // move to the next field
                    // onEditingComplete: _node.nextFocus,
                    decoration: const InputDecoration(
                      border: InputBorder.none,
                      hintText: "Enter Your Mobile Number",
                    ),
                    // The validator receives the text that the user has entered.
                    validator: (value) {
                      if (value == null || value.isEmpty) {
                        return 'Please enter your mobile number';
                      } else if (value.length < 10) {
                        return 'Enter Valid mobile number';
                      } else {
                        return null;
                      }
                    },
                  ),
    ]))));
    

    you can use it for specified builtin keyword. example

    autofillHints: const [AutofillHints.email],
    autofillHints: const [AutofillHints.password],
    autofillHints: const [AutofillHints.name] 
    

    remember you cant use your own keyword