Code Monkey home page Code Monkey logo

flutter_bloc_authentication's People

Contributors

vince-nyanga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flutter_bloc_authentication's Issues

How can i use the user info coming from Json?

I am trying to modify services/authentication_service.dart as i am trying to use Json for authentication but my authentication returns user information null. Here is my code

` Future signIn(String email, String password) async {

WidgetsFlutterBinding.ensureInitialized();
final http.Response response = await http.post("$SERVER_IP/rest-auth/login/",
    body: jsonEncode(<String, String>{
      'email':email,
      'password':password,
    }),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
      HttpHeaders.authorizationHeader: "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b",
    },
);
if (response.statusCode == 200) {

  print(response.body);
  return User.fromJSON(json.decode(response.body));
}

else {
throw AuthenticationException(message: 'Wrong email or password');
}

}
`

The data returns something like this

"user": { "id": "id here", "email": "[email protected]", "username": "userabc", }

The authentication is fine, i can get the data successfully but data is null when i try to decode it in User.
How can i return User() the way that it returns the JSON data?

nested blocbuilder

Hi ,Could you explain why you use nested blocbuider in your project ?Is it really necessary? I mean in main.dart and login_page.dart you use
BlocBuilder<AuthenticationBloc, AuthenticationState>. Why don't you check the state condition all in blocbuilder in main.dart ?

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.