Code Monkey home page Code Monkey logo

Comments (1)

ezmegy avatar ezmegy commented on September 13, 2024

I was experiencing the same and found the following things that could be relevant/the reason (in order of importance):

  1. Firebase API now throws FirebaseAuthException instead of PlatformException.
    See e.g. the docs of signInWithEmailAndPassword()
    and the docs of the exception class

There are different ways the code in this repo can be changed to handle this, one example (the one I'll probably go with for now) is this:

  • catch the widest Exception first, e.g. in EmailPasswordSignInPage class
    } on Exception catch (e) {
      _showSignInError(model, e);
    }

and forward that for display:
_showSignInError(EmailPasswordSignInModel model, Exception exception)

  • in PlatformExceptionAlertDialog class that's responsible for the display
    PlatformExceptionAlertDialog({String title, Exception exception})
    and
static String message(Exception exception) {
    if (exception is FirebaseAuthException) {
      return errors[exception.code] ?? exception.message;
    } else if (exception is PlatformException) {
      if (exception.message == 'FIRFirestoreErrorDomain') {
        if (exception.code == 'Code 7') {
          // This happens when we get a "Missing or insufficient permissions" error
          return 'This operation could not be completed due to a server error';
        }
        return exception.details;
      }
      return errors[exception.code] ?? exception.message;
    } else {
      // Note: this could turn out ugly on the UI, (change it if you can't afford that)
      // but at least you'll get some feedback
      return exception.toString();
    }
  }
  1. Your IDE settings could be "false-catching" the exceptions when you're in debug mode.
    Check this on VSCode and on Android Studio for more infos.

  2. You could have similar side-effects when changing the architecture of the repo, e.g. I found myself trying to simplify things a bit but than too much :D
    (I think this is a brilliant repo, but overcomplicated here and there - arguably for the sake of testability, but still.)

On a sidenote:
I'm not sure what the story is with the repo at the moment... Looking at the number and nature of issues it's missing maintenance power, but hopefully just temporarily.
(I might try and do a pull request with point 1. when/if I can, but there are probably other problems that would need assistance too...)

from firebase_auth_demo_flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.