Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #154

Closed
jonbhanson opened this issue Apr 12, 2021 · 8 comments
Closed

Documentation #154

jonbhanson opened this issue Apr 12, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@jonbhanson
Copy link

Thanks for the great package!
The documentation for the Null Safe version of the package shows various callbacks returning null, which is no longer possible with null safety. Please show how the returns should be handled in the new version.

@jonbhanson jonbhanson added the bug Something isn't working label Apr 12, 2021
@mafudge
Copy link

mafudge commented Apr 23, 2021

That does not seem to work. It does not matter what I enter here it always logs on. Am I doing something wrong?

image

@surister
Copy link
Contributor

@mafudge Share your pubspec.yml, make sure that you are using the latest flutter_login version.

@mafudge
Copy link

mafudge commented May 4, 2021

I am using

flutter_login: "2.0.0-nullsafety.0"

If my onLogin calls a function, it works but the same implementation within the onLogin does not work. If I get time I'll post an example for clarity.

@surister
Copy link
Contributor

surister commented May 4, 2021

@mafudge Create a new issue

@t-walker-wei
Copy link

That does not seem to work. It does not matter what I enter here it always logs on. Am I doing something wrong?

image

I have a question for you maybe I am stupid. Why not equal is not '!=' in your code?

@surister
Copy link
Contributor

This question is beyond the topic of the Issue but..

He is using font ligatures, if I am not mistaken, it is the Fira code font.
image

You can find more infomation here: https://github.com/tonsky/FiraCode

@lcsvcn
Copy link
Contributor

lcsvcn commented May 12, 2021

Hi, this is not a bug, the documentation is right.

It is a null safety package, but the onLogin and onSignup are Future<String?>?, that means that accepts null.

Maybe this could be changed in a near future to Future<String?> since is a required parameter, but at the moment is Future<String?>?. (I don't remember exactly why is a Future<String?>?, will take a look to remember later. I can update here after)

You need to use a Future<String?> function

Return null if it has success. Return string with error to be shown.

Example:

Duration get loginTime => Duration(milliseconds: 2250);

Future<String?> loginUser(LoginData data) {
   log.d('Name: ${data.name}, Password: ${data.password}');
   return Future.delayed(loginTime).then((_) async {
      /// Change this with your Sign In Logic
      /// expects [null] if success or [string] with error message.
      /// The error message will appear to users
      String? result = await _auth.doSignIn(data.name, data.password);
      return result;
   }
}

@lcsvcn
Copy link
Contributor

lcsvcn commented May 12, 2021

@juliansteenbakker This can be closed too. It is not a bug. I have provided a brief explanation above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants