Closed TJMusiitwa closed 4 years ago
Hi, thanks, I will try help you. It's typo?
password:_passwordController.text).then((value))=> Get.off(HomeScreen())
:'Get.snackbar('Please fix any errors and try again');
Before Get there are single quotes, and Get.snackbar does not have a title
Get.snackbar('Errors found','Please fix and try again');
Hey yes that was just a typo 😁. The rest is as is. Please continue
Please paste the error code so I can try to help you.
Hey so I was able to fix the above error but then not sure if it is because of the way I set up my code but I am unable to perform the sign out method
In my main method:
void main() async { Get.lazyPut<AuthService>(() => AuthService()); runApp(MyApp()); }
In my authservice:
static AuthService get authServ => Get.find(); Future signOutUser() async { await _firebaseAuth.signOut(); return Future.delayed(Duration.zero); }
Then the raisedbutton to call my signout method:
onPressed: () { AuthService.authServ.signOutUser().then((value) { Hive.box('kaziVendorBox').delete('currentUserIsTrue'); return Get.off(LoginScreen()); }); },
I get back the following error:
The following message was thrown while handling a gesture: I/flutter (28753): AuthService not found. You need call Get.put
(AuthService()) before
So should I again wrap my raised button with the GetBuilder callback to avoid the above error or is there some other way I should be handling this?
This is because Get.offAll will take all of your controllers out of memory. The Route Manager notifies the dependency manager that you have used a method that will "clean up" your stack, and SmartManagement will close all your Controllers registered on your routes, and delete them all. The first way to fix this is to "circumvent" SmartManagement using Get.put before GetMaterialApp (usually on main) and registering a dependency before it is in action (when you use lazy, it will only be created later, when GetMaterialApp is already will be in effect, and some route has already been registered, using Get.put, the instance will be registered immediately, which means that it will be registered without any link with SmartManagement if this happens before GetMaterialApp):
Get.put<AuthService>(AuthService());
instead
Get.lazyPut<AuthService>(() => AuthService());
Or simply use Binding
Get.off(Container(), binding: LoginBinding());
I will be sure to give this a try and update you. Right now, I am currently balancing a multitude of projects.
There are some examples in closed issues of how to use firebaseAuth with ever. Too easy. Without further details, it will not be possible to proceed with this issue, which is basically about configuring your project. If you face problems, you can open another issue.
Hey there great great package. I am currently using this package in combination with Firebase to handle to prime areas of business logic being authentication and firestore.
I did set up the base class for firebase auth as stated under the docs for state management.
When I then attempt to use this in my loginScreen Page as follows and I think here is where the error is showing up from
And this is my main.dart file
So what am I having to do wrong thus far and what should I change to get it working? Thank you