firebase / FirebaseUI-Flutter

Apache License 2.0
99 stars 86 forks source link

🐛 [firebase_ui_auth] Version 1.4.0 is causing compilation error #19

Closed outdoorapps closed 1 year ago

outdoorapps commented 1 year ago

The recent changes in version 1.4.0 are causing the following compilation error:

../../.pub-cache/hosted/pub.dev/firebase_ui_auth-1.4.0/lib/src/screens/profile_screen.dart:393:19: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. const Row( ^^^

The const keyword wasn't there in version 1.3.0.

darshankawar commented 1 year ago

Thanks for the report @outdoorapps I am unable to replicate it using the plugin example and running on Android. Can you provide dependencies you are using ?

outdoorapps commented 1 year ago

I opened a blank project to test things out with bare minimum dependencies like the below.

dependencies:
  flutter:
    sdk: flutter

  firebase_core: ^2.12.0
  firebase_ui_auth: ^1.4.0
  cupertino_icons: ^1.0.2

The first time it compiled ok but if I use the ProfileScreen widget like this:

  @override
  Widget build(BuildContext context) {
    return const ProfileScreen();
  }

It will give the forementioned error.

Taking a closer look to the source code, in profile_screen.dart, on line 393-400, it has:

const Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                LoadingIndicator(size: 16, borderWidth: 0.5),
                SizedBox(width: 16),
                Text('Waiting for email verification'),
              ],
            )

Somehow the const keyword sneaked into the source code because not even const Row() would work currently on flutter.

zachary-russell commented 1 year ago

Confirming I'm also having this issue.

josephomills commented 1 year ago

I'm also having the same issue. Row doesn't have a const constructor.

zachary-russell commented 1 year ago

Attempting to submit a fix for this, how open source of me 😄. If people want to fix it themselves they can move the const down in the code of the file where the error was specified (profile_screen.dart):


            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: const [
                LoadingIndicator(size: 16, borderWidth: 0.5),
                SizedBox(width: 16),
                Text('Waiting for email verification'),
              ],
            )
darshankawar commented 1 year ago

Thanks for the details. Seeing the same error upon following info shared https://github.com/firebase/FirebaseUI-Flutter/issues/19.

/cc @lesnitsky

lesnitsky commented 1 year ago

Fixed by https://github.com/firebase/flutterfire/pull/10957