-
Notifications
You must be signed in to change notification settings - Fork 0
Build/update deps #4
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e55ae46
chore: remove code coverage data
fulleni ae9e115
chore(.gitignore): update .gitignore file
fulleni 91a6cbe
build(deps): update dependency refs in core and email_client
fulleni eea4762
docs(README): rewrite for clarity, conciseness, and visual appeal
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,4 @@ | ||
| # See https://www.dartlang.org/guides/libraries/private-files | ||
|
|
||
| # Files and directories created by pub | ||
| .dart_tool/ | ||
| .packages | ||
| build/ | ||
| pubspec.lock | ||
| coverage/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,39 @@ | ||
| # email_inmemory | ||
| <div align="center"> | ||
| <img src="https://avatars.githubusercontent.com/u/202675624?s=400&u=dc72a2b53e8158956a3b672f8e52e39394b6b610&v=4" alt="Flutter News App Toolkit Logo" width="220"> | ||
| <h1>Email In-Memory</h1> | ||
| <p><strong>An in-memory implementation of the `EmailClient` interface for the Flutter News App Toolkit.</strong></p> | ||
| </div> | ||
|
|
||
|  | ||
| [](https://pub.dev/packages/very_good_analysis) | ||
| [](https://polyformproject.org/licenses/free-trial/1.0.0) | ||
| <p align="center"> | ||
| <img src="https://img.shields.io/badge/coverage-100%25-green?style=for-the-badge" alt="coverage"> | ||
| <a href="https://flutter-news-app-full-source-code.github.io/docs/"><img src="https://img.shields.io/badge/LIVE_DOCS-VIEW-slategray?style=for-the-badge" alt="Live Docs: View"></a> | ||
| <a href="https://github.com/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/MAIN_PROJECT-BROWSE-purple?style=for-the-badge" alt="Main Project: Browse"></a> | ||
| </p> | ||
|
|
||
| An in-memory implementation of the `EmailClient` interface, suitable for testing and development environments where actual email sending is not required. | ||
| This `email_inmemory` package provides an in-memory implementation of the `EmailClient` interface within the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). It is specifically designed for testing and development environments where actual email sending is not required. This package simulates the email dispatch process, allowing developers to verify email-related logic without the overhead or external dependencies of a live email service. It ensures consistent behavior and robust error handling based on the `email_client` contract. | ||
|
|
||
| ## Getting Started | ||
| ## ⭐ Feature Showcase: Simplified Email Testing & Development | ||
|
|
||
| Add the dependency to your `pubspec.yaml`: | ||
| This package offers a comprehensive set of features for managing email sending operations in a simulated environment. | ||
|
|
||
| ```yaml | ||
| dependencies: | ||
| email_inmemory: | ||
| git: | ||
| url: https://github.com/flutter-news-app-full-source-code/email-inmemory.git | ||
| # Use a specific ref/tag for stability in production | ||
| # ref: some-tag | ||
| ``` | ||
| <details> | ||
| <summary><strong>🧱 Core Functionality</strong></summary> | ||
|
|
||
| Then, import the package: | ||
| ### 🚀 `EmailClient` Implementation | ||
| - **`EmailInMemory` Class:** A concrete in-memory implementation of the `EmailClient` interface, providing a standardized way to simulate email sending. | ||
| - **Simulated Email Dispatch:** Accurately simulates the `sendTransactionalEmail` operation without sending actual emails, making it ideal for isolated testing. | ||
|
|
||
| ```dart | ||
| import 'package:email_inmemory/email_inmemory.dart'; | ||
| ``` | ||
|
|
||
| ## Features | ||
|
|
||
| * Provides an `EmailInMemory` class that implements the `EmailClient` interface. | ||
| * Simulates the `sendTransactionalEmail` operation without sending actual emails. | ||
| * Logs the simulated email details to the console, which is useful for debugging during development (e.g., viewing OTP codes). | ||
| * Includes basic input validation and throws standard `core` exceptions on failure. | ||
|
|
||
| ## Usage | ||
|
|
||
| Instantiate the client and use it where an `EmailClient` is expected. You can optionally provide a `Logger` instance. | ||
|
|
||
| ```dart | ||
| import 'package:email_client/email_client.dart'; | ||
| import 'package:email_inmemory/email_inmemory.dart'; | ||
| import 'package:core/core.dart'; | ||
| import 'package:logging/logging.dart'; | ||
| void main() async { | ||
| // Set up logging to see the output | ||
| Logger.root.level = Level.ALL; | ||
| Logger.root.onRecord.listen((record) { | ||
| print('${record.level.name}: ${record.time}: ${record.message}'); | ||
| }); | ||
| // Instantiate the in-memory client | ||
| final EmailClient emailClient = EmailInMemory(); | ||
| // Example: Sending a transactional email (simulated) | ||
| try { | ||
| await emailClient.sendTransactionalEmail( | ||
| senderEmail: 'noreply@example.com', | ||
| recipientEmail: 'test@example.com', | ||
| subject: 'Your One-Time Code', | ||
| templateId: 'd-12345', | ||
| templateData: {'otp_code': '987654'}, | ||
| ); | ||
| print('Successfully simulated sending email.'); | ||
| } on HttpException catch (e) { | ||
| print('Failed to send email: $e'); | ||
| } | ||
| } | ||
| ``` | ||
| ### 🌐 Debugging & Validation | ||
| - **Console Logging:** Logs simulated email details (sender, recipient, template ID, template data) to the console, which is highly useful for debugging and verifying email content during development. | ||
| - **Input Validation:** Includes basic input validation and throws standard `HttpException` subtypes (from `core`) on failure, ensuring consistent error handling in a simulated context. | ||
|
|
||
| ### 💉 Interface-Driven Design | ||
| - **Decoupled Logic:** By implementing the `EmailClient` interface, this package ensures that application logic remains decoupled from specific email service providers, allowing for flexible testing strategies. | ||
|
|
||
| > **💡 Your Advantage:** This package provides a reliable, in-memory email client that simplifies testing and development of email-related features. It eliminates the need for external email service dependencies during development, offering immediate feedback and consistent behavior for your email logic. | ||
| </details> | ||
|
|
||
| ## 🔑 Licensing | ||
|
|
||
| This package is source-available and licensed under the [PolyForm Free Trial 1.0.0](LICENSE). Please review the terms before use. | ||
|
|
||
| For commercial licensing options that grant the right to build and distribute unlimited applications, please visit the main [**Flutter News App - Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code) organization. | ||
| This `email_inmemory` package is an integral part of the [**Flutter News App Full Source Code Toolkit**](https://github.com/flutter-news-app-full-source-code). For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the main toolkit organization page. | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.