create method Null safety

Future<InteractiveAuthorizationRequest> create(
  1. {required String clientId,
  2. String? clientSecret,
  3. required String redirectUrl,
  4. required Iterable<String> scopes,
  5. required OpenIdConfiguration configuration,
  6. required bool autoRefresh,
  7. String? loginHint,
  8. Iterable<String>? prompts,
  9. Map<String, String>? additionalParameters,
  10. int popupWidth = 640,
  11. int popupHeight = 600,
  12. bool useWebPopup = true}
)

Implementation

static Future<InteractiveAuthorizationRequest> create({
  required String clientId,
  String? clientSecret,
  required String redirectUrl,
  required Iterable<String> scopes,
  required OpenIdConfiguration configuration,
  required bool autoRefresh,
  String? loginHint,
  Iterable<String>? prompts,
  Map<String, String>? additionalParameters,
  int popupWidth = 640,
  int popupHeight = 600,
  bool useWebPopup = true,
}) async {
  final codeVerifier = List.generate(
      128, (i) => _charset[Random.secure().nextInt(_charset.length)]).join();

  final sha256 = crypto.Sha256();

  final codeChallenge = base64Url
      .encode((await sha256.hash(ascii.encode(codeVerifier))).bytes)
      .replaceAll('=', '');

  return InteractiveAuthorizationRequest._(
    clientId: clientId,
    redirectUrl: redirectUrl,
    scopes: scopes,
    configuration: configuration,
    autoRefresh: autoRefresh,
    codeVerifier: codeVerifier,
    codeChallenge: codeChallenge,
    additionalParameters: additionalParameters,
    clientSecret: clientSecret,
    loginHint: loginHint,
    prompts: prompts,
    popupHeight: popupHeight,
    popupWidth: popupWidth,
    useWebPopup: useWebPopup,
  );
}