OAuthWidget constructor

const OAuthWidget({
  1. required Key key,
  2. dynamic onAuth(
    1. OAuth? oAuth,
    2. AuthData accessToken
    ) = _defaultOnAuth,
  3. dynamic onAuthCode(
    1. AuthCodeData data,
    2. bool isCompletion
    ) = _defaultOnAuthCode,
  4. dynamic onError(
    1. OAuth? oAuth,
    2. AuthError error
    ) = _defaultOnError,
  5. Set<OAuth> oAuths = const {...OAuth.values},
  6. OAuthButtonConfiguration buttonConfig = const OAuthButtonConfiguration(),
  7. OAuthWidgetTheme theme = OAuthWidgetTheme.system,
  8. UIAuthParams authParams = const UIAuthParams._(),
})

Constructs a OAuthWidget with OAuths.

There are some parameters, that you can provide. key can be used to retrieve State of the widget. onAuth will be called after successful auth if you passed PublicFlowData to authParams. onAuthCode will be called if you passed ConfidentialFlowData to authParams instead of PublicFlowData. This function provides AuthCodeData that should be used on your server side to get AccessToken and RefreshToken. isCompletion indicates that the method onAuth won't be called. onError will be called if any error was encountered during auth. oAuths specifies OAuth providers. By default, all providers will be shown. buttonConfig allows to configure OAuth buttons. theme allows to configure widget theme. authParams specify auth flow and scopes. Read more about them in UIAuthParamsBuilder.

Implementation

const OAuthWidget({
  required Key key,
  Function(OAuth? oAuth, AuthData accessToken) onAuth = _defaultOnAuth,
  Function(AuthCodeData data, bool isCompletion) onAuthCode =
      _defaultOnAuthCode,
  Function(OAuth? oAuth, AuthError error) onError = _defaultOnError,
  Set<OAuth> oAuths = const {...OAuth.values},
  OAuthButtonConfiguration buttonConfig = const OAuthButtonConfiguration(),
  OAuthWidgetTheme theme = OAuthWidgetTheme.system,
  UIAuthParams authParams = const UIAuthParams._(),
})  : _onAuth = onAuth,
      _onAuthCode = onAuthCode,
      _onError = onError,
      _oAuths = oAuths,
      _buttonConfig = buttonConfig,
      _theme = theme,
      _authParams = authParams,
      super(key: key);