0% found this document useful (0 votes)
26 views

de5

The document discusses a generic authentication package for Flutter that supports Firebase Authentication, including Google, Facebook, and email sign-in. It highlights the importance of code coverage in testing and introduces a mocked mode for testing platform channels, allowing for comprehensive testing without unexpected issues. The package is available on pub.dev and aims to assist others facing similar challenges in implementing authentication in Flutter applications.

Uploaded by

sonumonuu096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

de5

The document discusses a generic authentication package for Flutter that supports Firebase Authentication, including Google, Facebook, and email sign-in. It highlights the importance of code coverage in testing and introduces a mocked mode for testing platform channels, allowing for comprehensive testing without unexpected issues. The package is available on pub.dev and aims to assist others facing similar challenges in implementing authentication in Flutter applications.

Uploaded by

sonumonuu096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Firebase Authentication

The source repo, also listed on pub.dev (https://pub.dev/), is


available at gitlab.com/playscale-free/authenticator.I will
likely, eventually use this for production unless someone
more clever than myself (a low bar, to be sure) comes along
with something better, or if someone in this sub can point
me to a better wheel already made than the one I put
together.I hope others can find this helpful. The Flutter
community has been extremely helpful and encouraging as
I learn an entirely different language, tool-set and libraries.

It does cover Facebook login, Google Sign-in, email sign-


in, registering a new account via email, requesting a
password reset email, and most of the error cases
involved with those.

I also like my tests to complete quickly, and flutter drive on


an emulator is not exactly speedy-turnaround on
changes.There was a lull between sprints to take some time
out to try to tackle the problem.

It worked great (well, a few problems with


flutter_facebook_login that the author fixed quickly).I like
having 100% code coverage for tests. For a while, I
resigned myself to using flutter drive. I went so far as to set
up dedicated CI runners with emulators active for the driver
to run on and it is very nice, but there is no code coverage
reporting with flutter drive. I like to know when I make a
change that is potentially untested.
Firebase Authentication and flutter test
Hi FlutterDevs!I am fairly new to Flutter. One of the first
things I attempted was a basic login flow for a Firebase app
using Google, Facebook and email authentication.

There was one esoteric reference to platform channels on


one comment on one bug report hiding some pages down
on a lucky Google search about the problem. Mockito and
other mocking approaches just did not provide the degree of
coverage required, but hijacking the device platform
channels seemed like the "correct" way to go about it.The
product of that lull between sprints was a pretty generic
authentication package that has the option to run in a
"mocked" mode under the test VM. Tests can even force the
mocked platform channels to throw specific exceptions so
the tests can easily trigger failure cases to achieve total code
coverage. It uses the Provider pattern, but also plays nicely
with a Singleton pattern via GetIt.Instead of being "just
another simple authentication" package, the important part
is that it includes mocks for the platform channels so that
firebase_auth, flutter_facebook_auth and google_sign_in
can run under flutter test without rapid, unexpected
disassembly on launch.For those that may also have run
into this testing wall using Firebase for authentication, this
might come in handy, if only to see how the platform
channel mocks work to make your app testable with
Firebase authentication.It is available on pub.dev as
authenticator (https://pub.dev/packages/authenticator).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy