logout method
LogoutUser - Valid for any authentication. This method logs out the current user from Firebase Authentication. It handles FirebaseAuthException to provide custom error messages. @throws String if the logout fails due to an authentication error.
Implementation
Future<void> logout() async {
try {
await FirebaseAuth.instance.signOut();
Get.offAll(() => const WelcomeScreen());
} on FirebaseAuthException catch (e) {
throw e.message!;
} on FormatException catch (e) {
throw e.message;
} catch (e) {
throw 'Unable to logout. Try again.';
}
}