The named parameter '~' isn't defined

Viewed 42

I'm flutter beginner. I'm using local-auth for making Bio auth function. but error like below, I don't get the error why it occurs. Could you advice for this? why is it doesn't work in authenticate(), useErrorDialogs, stickyAuth, biometricOnly those three objects occurs error?

    class AuthService {
    static Future<bool> authenticate({
    String localizedReason,
    bool useErrorDialogs,
    bool stickyAuth,
    bool biometricOnly ,
    }) {
      // TODO: implement authenticate
      throw UnimplementedError();
    }

    static Future<bool> authenticateUser() async {

    //initialize Local Authentication plugin.
    final LocalAuthentication _localAuthentication = LocalAuthentication();
    //status of authentication.
    bool isAuthenticated = false;
    //check if device supports biometrics authentication.
    bool isBiometricSupported = await _localAuthentication.isDeviceSupported();
    //check if user has enabled biometrics.
    //check
    bool canCheckBiometrics = await _localAuthentication.canCheckBiometrics;


    //if device supports biometrics and user has enabled biometrics, then authenticate.
    if (isBiometricSupported && canCheckBiometrics) {
      try {
        isAuthenticated = await _localAuthentication.authenticate(
            localizedReason: 'Scan your fingerprint to authenticate',
            useErrorDialogs: true,
            stickyAuth: true,
            biometricOnly: true,
        );
      } on PlatformException catch (e) {
        print(e);
      }
    }
    return isAuthenticated;
  }
}
0 Answers
Related