Coder Social home page Coder Social logo

rutuja369 / flutter-role-based-login-architecture Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adumrewal/role-based-login-architecture

0.0 0.0 0.0 362 KB

Flutter: Role based user authentication and login management. Simplified and modular architecture

License: MIT License

Ruby 8.79% Objective-C 0.25% Kotlin 0.93% Dart 87.42% Swift 2.62%

flutter-role-based-login-architecture's Introduction

Login & Role Based User Authentication Architecture

Tech: Flutter and Firebase

Efficient state management and navigation for apps with specific home screens for various user roles.

Many times when working on an app we come across the following scenario:

  • How does one control navigation and state management in the app wrt login/logout/user-role
  • Every app requires a separate screen for logged in users vs not logged in users
  • Also, if your app has multiple user roles, like Admin, Student, Teacher, Staff, it becomes very cumbersome to manage which view to show for each user and how to ensure one user type does not have access to outside information

Here in this repository I have provided a very simple structure for the app to ensure when there is a change in user state, the app gets updated automatically.

Architecture / Sequence Diagram

sequence-diagram

Screenshots

Login Screen Admin Home Student Home
login-screen admin-portal student-portal

Suppose you are in the login screen and press the login button. In this case the user should be navigated inside the app and we should pop the login screen from the app. Adding if the user is an Admin types, he should be shown screen 2 vs screen 3 or X for other user roles.

Now for a logged in user, when they logout, the entire state of the app should be refreshed and a login screen should be shown. (i.e. They should not have access to previously shown information)

The relevant files are available inside the lib folder. main.dart, routes.dart, loginManager.dart and homePageNavigator.dart are the main files required to create an efficient login structure. Others are just helpers to create a sample app.

Getting Started

A few resources to get you started if this is your first Flutter project:

I use VSCode for running flutter applications. It is very efficient and works like a charm. Open the project folder in VSCode and click on run. Your sample app will get launched.

If you like this repo and would like me to work on more such sample projects, please do let me know or give it a โญ

If you are working on a flutter project and are stuck anywhere, feel free to reach out. Would be happy to help :)

flutter-role-based-login-architecture's People

Contributors

adumrewal avatar

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.