The app just begin and I do the sign in first. It was both working on android and ios, but then later in fews day I resume to work on the app, the sign in only work on android.

On iOS, when I use google sign in, and it open a page to accounts.google.com i supposed, then it should ask for the email and password, but it didn't. It only say

Safari cannot open the page because it could not establish a secure connection to the server.

The output of flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.5.9-pre.56, on Mac OS X 10.14.4 18E226, locale en-KH)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
[!] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.33.1)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

The pubspec.yml

name: xxx
description: xxx

version: 0.0.1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  google_sign_in: ^4.0.1+3
  rxdart: ^0.21.0
  corsac_jwt: ^0.1.2
  graphql_flutter: ^1.0.0
  qr_flutter: ^2.0.0

  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true

  assets:
   - assets/google.png

Here is the login_screen.dart

import 'package:flutter/material.dart' as flutter_material;
import 'package:flutter/cupertino.dart' show CupertinoButton;

import '../blocs/bloc_provider.dart' show BlocProvider;
import '../blocs/login_bloc.dart' show LoginBloc;

const String _loginInText = 'Sign In';
const String _googleIconPath = 'assets/google.png';

const double _iconWidth = 39.0;
const double _iconHeight = 39.0;
const double _sizedBoxWidth = 10.0;
const double _signInFontSize = 23.0;

class LoginScreen extends flutter_material.StatelessWidget {
  @override
  flutter_material.Widget build(flutter_material.BuildContext context) {
    final LoginBloc loginBloc = BlocProvider.of<LoginBloc>(context);

    return flutter_material.Scaffold(
      body: flutter_material.Center(
        child: CupertinoButton(
          // splashColor: flutter_material.Colors.transparent,
          child: flutter_material.Row(
            mainAxisSize: flutter_material.MainAxisSize.min,
            crossAxisAlignment: flutter_material.CrossAxisAlignment.center,
            children: const <flutter_material.Widget>[
              const flutter_material.Image(
                image: flutter_material.AssetImage(_googleIconPath),
                width: _iconWidth,
                height: _iconHeight,
              ),
              const flutter_material.SizedBox(width: _sizedBoxWidth, height: 0.0),
              const flutter_material.Text(
                _loginInText,
                style: flutter_material.TextStyle(
                  fontSize: _signInFontSize,
                ),
              ),
            ],
          ),
          onPressed: loginBloc.signIn,
        ),
      ),
    );
  }
}

the logic_bloc.dart

import 'package:google_sign_in/google_sign_in.dart'
  show GoogleSignIn, GoogleSignInAccount, GoogleSignInAuthentication;
import 'package:rxdart/rxdart.dart' as rxdart;

import './bloc_provider.dart' show BlocBase;

class LoginBloc extends BlocBase {
  final GoogleSignIn _gSignIn = GoogleSignIn(scopes: ['openid']);

  final rxdart.PublishSubject<GoogleSignInAuthentication> _googleSignIn =
    rxdart.PublishSubject<GoogleSignInAuthentication>();

  rxdart.Observable<GoogleSignInAuthentication> get loginStream => this._googleSignIn.stream;

  void signIn() async {
    final GoogleSignInAccount account = await this._gSignIn.signIn();

    if (account != null) {
      this._googleSignIn.sink.add(await account.authentication);
    }
  }

  void signOut() async {
    await this._gSignIn.signOut();

    this._googleSignIn.sink.add(null);
  }

  @override
  void dispose() async {
    await this._googleSignIn.drain();
    this._googleSignIn.close();
  }
}

So below are the actual result:

UPDATE 1: I also tested on example of the package. It also show cannot connect to the page

0 Answers