https://github.com/flutter-news-app-full-source-code/auth-inmemory
An in-memory implementation of the `AuthClient` interface for the Flutter News App Toolkit.
https://github.com/flutter-news-app-full-source-code/auth-inmemory
Last synced: 4 months ago
JSON representation
An in-memory implementation of the `AuthClient` interface for the Flutter News App Toolkit.
- Host: GitHub
- URL: https://github.com/flutter-news-app-full-source-code/auth-inmemory
- Owner: flutter-news-app-full-source-code
- License: other
- Created: 2025-06-06T04:14:06.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2026-01-12T18:35:18.000Z (5 months ago)
- Last Synced: 2026-02-08T08:55:27.878Z (4 months ago)
- Language: Dart
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Auth In-Memory
An in-memory implementation of the `AuthClient` interface for the Flutter News App Toolkit.
This `auth_inmemory` package provides an in-memory implementation of the `AuthClient` interface within the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). It offers a mock authentication client that operates entirely on in-memory data, making it suitable for demonstration purposes, local development, and testing without requiring a live backend. This package simulates various authentication flows, ensuring consistent behavior and robust error handling based on the `auth_client` contract.
## ⭐ Feature Showcase: Simplified Authentication Testing & Development
This package offers a comprehensive set of features for managing authentication operations in a simulated environment.
🧱 Core Functionality
### 🚀 `AuthClient` Implementation
- **`AuthInmemory` Class:** A concrete in-memory implementation of the `AuthClient` interface, providing a standardized way to simulate authentication.
- **Simulated Authentication Flows:** Implements `requestSignInCode`, `verifySignInCode`, `signInAnonymously`, and `signOut` to simulate various authentication processes.
- **Reactive State Changes:** Provides `authStateChanges` (a stream that emits the current authenticated `User` or `null` on state changes) and `getCurrentUser` to retrieve the current user.
### 🌐 Debugging & Validation
- **Privileged Flow Simulation:** Supports an `isDashboardLogin` flag in `requestSignInCode` and `verifySignInCode` to simulate privileged flows, allowing testing of role-specific authentication logic (e.g., only privileged users like `admin@example.com` and `publisher@example.com` are allowed).
- **Token Retrieval:** Includes a `currentToken` getter to retrieve the simulated authentication token for inspection during development.
### 🛡️ Standardized Error Handling
- **`HttpException` Propagation:** Throws standard `HttpException` subtypes (e.g., `UnauthorizedException`, `NotFoundException`, `AuthenticationException`, `InvalidInputException`) from `core` on simulated failures, ensuring consistent error handling in a testing context.
> **💡 Your Advantage:** This package provides a reliable, in-memory authentication client that simplifies testing and development of authentication-related features. It eliminates the need for external backend dependencies during development, offering immediate feedback and consistent behavior for your authentication logic, especially for complex scenarios like privileged logins.
## 🔑 Licensing
This source code is licensed for commercial use and is provided for local evaluation. A **Lifetime Commercial License** is required for any production or public-facing application.
Please visit the main [Flutter News App Full Source Code Toolkit](https://github.com/flutter-news-app-full-source-code) organization page to review the full license terms and to purchase.