Search docs...
K

Technical Documentation: Login Screen

Architecture

login (Light Theme)login (Dark Theme)

The Login Screen is implemented as a StatefulWidget in Flutter. It serves as the initial route of the application and coordinates with the AuthProvider to manage the authentication lifecycle.

Technical Details

  • File Path: lib/screens/login_screen.dart
  • State Management: Uses Provider pattern via AuthProvider.
  • API Integration: Calls the /auth/login endpoint on the Go Backend.
  • Security: Implements JWT-based authentication. Passwords are transmitted over secure channels and managed by the backend's Bcrypt hashing system.

Data Model

Login Request

Json
{
  "username": "user_string",
  "password": "password_string"
}

Login Response

Json
{
  "token": "jwt_token_string",
  "user": {
    "id": 1,
    "username": "admin",
    "role": "admin"
  }
}

Logic Flow

  1. Form Validation: The _handleLogin method validates that both fields are non-empty.
  2. Auth Call: Invokes authProvider.login(username, password).
  3. Redirection: On status code 200, uses Navigator.pushReplacement to navigate to the DashboardLayout.
  4. Error State: Catches specific HTTP errors (401 Unauthorized, 403 Forbidden) and updates the UI state to show descriptive error snackbars.
© 2026 Robotoai. All rights reserved.