LCOV - code coverage report
Current view: top level - auth/utils - login_configs.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 11 0.0 %
Date: 2022-03-03 12:16:56 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/foundation.dart';
       2             : import 'package:flutterfire_ui/auth.dart';
       3             : 
       4             : abstract class LoginConfig {
       5             :   ProviderConfiguration toFlutterFireConfig();
       6             : }
       7             : 
       8             : // The flutterfire docs aren't clear why we need a clientId and seem to say to
       9             : // use the appId... need to look into it more and document here
      10             : class GoogleLoginConfig with LoginConfig {
      11           0 :   GoogleLoginConfig(this.clientId);
      12             : 
      13             :   final String clientId;
      14             : 
      15           0 :   @override
      16             :   ProviderConfiguration toFlutterFireConfig() =>
      17           0 :       GoogleProviderConfiguration(clientId: clientId);
      18             : }
      19             : 
      20             : class EmailLoginConfig with LoginConfig {
      21           0 :   @override
      22             :   ProviderConfiguration toFlutterFireConfig() =>
      23             :       const EmailProviderConfiguration();
      24             : }
      25             : 
      26             : class AppleLoginConfig with LoginConfig {
      27           0 :   @override
      28             :   ProviderConfiguration toFlutterFireConfig() =>
      29             :       const AppleProviderConfiguration();
      30             : }
      31             : 
      32             : /// A [PlatformDefaultLoginConfig] object can be included in the `logins` list
      33             : /// passed to the AppWidget and will result in a Sign In with Apple button on
      34             : /// ios and macos and a Google Sign In button on Android and web.
      35             : class PlatformDefaultLoginConfig with LoginConfig {
      36           0 :   PlatformDefaultLoginConfig({this.clientId});
      37             : 
      38             :   final String? clientId;
      39             : 
      40           0 :   @override
      41             :   ProviderConfiguration toFlutterFireConfig() {
      42           0 :     final platform = defaultTargetPlatform;
      43           0 :     if ((kIsWeb || platform == TargetPlatform.android) && clientId == null) {
      44             :       throw 'Web and Android use Google Sign in so using PlatformDefaultLoginConfig requires providing a clientId';
      45             :     }
      46             : 
      47           0 :     return (platform == TargetPlatform.iOS || platform == TargetPlatform.macOS)
      48             :         ? const AppleProviderConfiguration()
      49           0 :         : GoogleProviderConfiguration(clientId: clientId!);
      50             :   }
      51             : }

Generated by: LCOV version 1.13