useAuthEmulator method Null safety

Future<void> useAuthEmulator(
  1. String host,
  2. int port
)

Changes this instance to point to an Auth emulator running locally.

Set the host of the local emulator, such as "localhost" Set the port of the local emulator, such as "9099" (port 9099 is default for auth package)

Note: Must be called immediately, prior to accessing auth methods. Do not use with production credentials as emulator traffic is not encrypted.

Implementation

Future<void> useAuthEmulator(String host, int port) async {
  String mappedHost = host;

  if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) {
    if (mappedHost == 'localhost' || mappedHost == '127.0.0.1') {
      // ignore: avoid_print
      print('Mapping Auth Emulator host "$mappedHost" to "10.0.2.2".');
      mappedHost = '10.0.2.2';
    }
  }

  await _delegate.useAuthEmulator(mappedHost, port);
}