Repository: Decron/Whitebox-Code-GPT Branch: main Commit: a5dbf33d4dd9 Files: 345 Total size: 317.4 KB Directory structure: gitextract_6tcd7rgx/ ├── .github/ │ └── FUNDING.yml ├── C++ GPT/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ └── standards ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Firebase GPT/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ └── standards ├── Flutter GPT/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ ├── examples/ │ │ ├── .github/ │ │ │ ├── CODEOWNERS │ │ │ ├── DOCS_ISSUE_TEMPLATE.md │ │ │ ├── FUNDING.yml │ │ │ ├── ISSUE_TEMPLATE/ │ │ │ │ ├── bug_report.md │ │ │ │ ├── build.md │ │ │ │ ├── chore.md │ │ │ │ ├── ci.md │ │ │ │ ├── config.yml │ │ │ │ ├── documentation.md │ │ │ │ ├── feature_request.md │ │ │ │ ├── performance.md │ │ │ │ ├── refactor.md │ │ │ │ ├── revert.md │ │ │ │ ├── style.md │ │ │ │ └── test.md │ │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ │ └── workflows/ │ │ │ ├── angular_bloc.yaml │ │ │ ├── angular_dart_examples.yaml │ │ │ ├── bloc.yaml │ │ │ ├── bloc_concurrency.yaml │ │ │ ├── bloc_test.yaml │ │ │ ├── bloc_tools.yaml │ │ │ ├── build.yaml │ │ │ ├── docs.yaml │ │ │ ├── flutter_bloc.yaml │ │ │ ├── flutter_examples.yaml │ │ │ ├── hydrated_bloc.yaml │ │ │ └── replay_bloc.yaml │ │ ├── .gitignore │ │ └── flutter_bloc/ │ │ ├── angular_counter/ │ │ │ ├── .gitignore │ │ │ └── counter_bloc.dart │ │ ├── flutter_bloc_with_stream/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── bloc/ │ │ │ │ ├── ticker_bloc.dart │ │ │ │ ├── ticker_event.dart │ │ │ │ └── ticker_state.dart │ │ │ ├── main.dart │ │ │ └── ticker/ │ │ │ └── ticker.dart │ │ ├── flutter_complex_list/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── complex_list/ │ │ │ │ ├── complex_list.dart │ │ │ │ ├── cubit/ │ │ │ │ │ ├── complex_list_cubit.dart │ │ │ │ │ └── complex_list_state.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── item.dart │ │ │ │ │ └── models.dart │ │ │ │ └── view/ │ │ │ │ ├── complex_list_page.dart │ │ │ │ └── view.dart │ │ │ ├── main.dart │ │ │ ├── repository.dart │ │ │ └── simple_bloc_observer.dart │ │ ├── flutter_counter/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── counter/ │ │ │ │ ├── counter.dart │ │ │ │ ├── cubit/ │ │ │ │ │ └── counter_cubit.dart │ │ │ │ └── view/ │ │ │ │ ├── counter_page.dart │ │ │ │ ├── counter_view.dart │ │ │ │ └── view.dart │ │ │ ├── counter_observer.dart │ │ │ └── main.dart │ │ ├── flutter_dynamic_form/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── main.dart │ │ │ ├── new_car/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── new_car_bloc.dart │ │ │ │ │ ├── new_car_event.dart │ │ │ │ │ └── new_car_state.dart │ │ │ │ ├── new_car.dart │ │ │ │ └── view/ │ │ │ │ └── new_car_page.dart │ │ │ └── new_car_repository.dart │ │ ├── flutter_firebase_login/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app/ │ │ │ │ ├── app.dart │ │ │ │ ├── bloc/ │ │ │ │ │ ├── app_bloc.dart │ │ │ │ │ ├── app_event.dart │ │ │ │ │ └── app_state.dart │ │ │ │ ├── bloc_observer.dart │ │ │ │ ├── routes/ │ │ │ │ │ └── routes.dart │ │ │ │ └── view/ │ │ │ │ └── app.dart │ │ │ ├── generated_plugin_registrant.dart │ │ │ ├── home/ │ │ │ │ ├── home.dart │ │ │ │ ├── view/ │ │ │ │ │ └── home_page.dart │ │ │ │ └── widgets/ │ │ │ │ ├── avatar.dart │ │ │ │ └── widgets.dart │ │ │ ├── login/ │ │ │ │ ├── cubit/ │ │ │ │ │ ├── login_cubit.dart │ │ │ │ │ └── login_state.dart │ │ │ │ ├── login.dart │ │ │ │ └── view/ │ │ │ │ ├── login_form.dart │ │ │ │ ├── login_page.dart │ │ │ │ └── view.dart │ │ │ ├── main.dart │ │ │ ├── sign_up/ │ │ │ │ ├── cubit/ │ │ │ │ │ ├── sign_up_cubit.dart │ │ │ │ │ └── sign_up_state.dart │ │ │ │ ├── sign_up.dart │ │ │ │ └── view/ │ │ │ │ ├── sign_up_form.dart │ │ │ │ ├── sign_up_page.dart │ │ │ │ └── view.dart │ │ │ └── theme.dart │ │ ├── flutter_form_validation/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── bloc/ │ │ │ │ ├── my_form_bloc.dart │ │ │ │ ├── my_form_event.dart │ │ │ │ └── my_form_state.dart │ │ │ ├── main.dart │ │ │ └── models/ │ │ │ ├── email.dart │ │ │ ├── models.dart │ │ │ └── password.dart │ │ ├── flutter_infinite_list/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── main.dart │ │ │ ├── posts/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── post_bloc.dart │ │ │ │ │ ├── post_event.dart │ │ │ │ │ └── post_state.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── models.dart │ │ │ │ │ └── post.dart │ │ │ │ ├── posts.dart │ │ │ │ ├── view/ │ │ │ │ │ ├── posts_list.dart │ │ │ │ │ ├── posts_page.dart │ │ │ │ │ └── view.dart │ │ │ │ └── widgets/ │ │ │ │ ├── bottom_loader.dart │ │ │ │ ├── post_list_item.dart │ │ │ │ └── widgets.dart │ │ │ └── simple_bloc_observer.dart │ │ ├── flutter_login/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── authentication/ │ │ │ │ ├── authentication.dart │ │ │ │ └── bloc/ │ │ │ │ ├── authentication_bloc.dart │ │ │ │ ├── authentication_event.dart │ │ │ │ └── authentication_state.dart │ │ │ ├── home/ │ │ │ │ ├── home.dart │ │ │ │ └── view/ │ │ │ │ └── home_page.dart │ │ │ ├── login/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── login_bloc.dart │ │ │ │ │ ├── login_event.dart │ │ │ │ │ └── login_state.dart │ │ │ │ ├── login.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── models.dart │ │ │ │ │ ├── password.dart │ │ │ │ │ └── username.dart │ │ │ │ └── view/ │ │ │ │ ├── login_form.dart │ │ │ │ ├── login_page.dart │ │ │ │ └── view.dart │ │ │ ├── main.dart │ │ │ └── splash/ │ │ │ ├── splash.dart │ │ │ └── view/ │ │ │ └── splash_page.dart │ │ ├── flutter_shopping_cart/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── cart/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── cart_bloc.dart │ │ │ │ │ ├── cart_event.dart │ │ │ │ │ └── cart_state.dart │ │ │ │ ├── cart.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── cart.dart │ │ │ │ │ └── models.dart │ │ │ │ └── view/ │ │ │ │ └── cart_page.dart │ │ │ ├── catalog/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── catalog_bloc.dart │ │ │ │ │ ├── catalog_event.dart │ │ │ │ │ └── catalog_state.dart │ │ │ │ ├── catalog.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── catalog.dart │ │ │ │ │ ├── item.dart │ │ │ │ │ └── models.dart │ │ │ │ └── view/ │ │ │ │ └── catalog_page.dart │ │ │ ├── main.dart │ │ │ ├── shopping_repository.dart │ │ │ └── simple_bloc_observer.dart │ │ ├── flutter_timer/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── main.dart │ │ │ ├── ticker.dart │ │ │ └── timer/ │ │ │ ├── bloc/ │ │ │ │ ├── timer_bloc.dart │ │ │ │ ├── timer_event.dart │ │ │ │ └── timer_state.dart │ │ │ ├── timer.dart │ │ │ └── view/ │ │ │ └── timer_page.dart │ │ ├── flutter_todos/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── .vscode/ │ │ │ │ └── launch.json │ │ │ ├── app/ │ │ │ │ ├── app.dart │ │ │ │ └── app_bloc_observer.dart │ │ │ ├── bootstrap.dart │ │ │ ├── edit_todo/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── edit_todo_bloc.dart │ │ │ │ │ ├── edit_todo_event.dart │ │ │ │ │ └── edit_todo_state.dart │ │ │ │ ├── edit_todo.dart │ │ │ │ └── view/ │ │ │ │ ├── edit_todo_page.dart │ │ │ │ └── view.dart │ │ │ ├── generated_plugin_registrant.dart │ │ │ ├── home/ │ │ │ │ ├── cubit/ │ │ │ │ │ ├── home_cubit.dart │ │ │ │ │ └── home_state.dart │ │ │ │ ├── home.dart │ │ │ │ └── view/ │ │ │ │ ├── home_page.dart │ │ │ │ └── view.dart │ │ │ ├── l10n/ │ │ │ │ ├── arb/ │ │ │ │ │ └── app_en.arb │ │ │ │ └── l10n.dart │ │ │ ├── main_development.dart │ │ │ ├── main_production.dart │ │ │ ├── main_staging.dart │ │ │ ├── stats/ │ │ │ │ ├── bloc/ │ │ │ │ │ ├── stats_bloc.dart │ │ │ │ │ ├── stats_event.dart │ │ │ │ │ └── stats_state.dart │ │ │ │ ├── stats.dart │ │ │ │ └── view/ │ │ │ │ ├── stats_page.dart │ │ │ │ └── view.dart │ │ │ ├── theme/ │ │ │ │ └── theme.dart │ │ │ └── todos_overview/ │ │ │ ├── bloc/ │ │ │ │ ├── todos_overview_bloc.dart │ │ │ │ ├── todos_overview_event.dart │ │ │ │ └── todos_overview_state.dart │ │ │ ├── models/ │ │ │ │ ├── models.dart │ │ │ │ └── todos_view_filter.dart │ │ │ ├── todos_overview.dart │ │ │ ├── view/ │ │ │ │ ├── todos_overview_page.dart │ │ │ │ └── view.dart │ │ │ └── widgets/ │ │ │ ├── todo_list_tile.dart │ │ │ ├── todos_overview_filter_button.dart │ │ │ ├── todos_overview_options_button.dart │ │ │ └── widgets.dart │ │ ├── flutter_weather/ │ │ │ ├── .gitignore │ │ │ ├── .metadata │ │ │ ├── app.dart │ │ │ ├── main.dart │ │ │ ├── search/ │ │ │ │ ├── search.dart │ │ │ │ └── view/ │ │ │ │ └── search_page.dart │ │ │ ├── settings/ │ │ │ │ ├── settings.dart │ │ │ │ └── view/ │ │ │ │ └── settings_page.dart │ │ │ ├── theme/ │ │ │ │ ├── cubit/ │ │ │ │ │ └── theme_cubit.dart │ │ │ │ └── theme.dart │ │ │ ├── weather/ │ │ │ │ ├── cubit/ │ │ │ │ │ ├── weather_cubit.dart │ │ │ │ │ ├── weather_cubit.g.dart │ │ │ │ │ └── weather_state.dart │ │ │ │ ├── models/ │ │ │ │ │ ├── models.dart │ │ │ │ │ ├── weather.dart │ │ │ │ │ └── weather.g.dart │ │ │ │ ├── view/ │ │ │ │ │ └── weather_page.dart │ │ │ │ ├── weather.dart │ │ │ │ └── widgets/ │ │ │ │ ├── weather_empty.dart │ │ │ │ ├── weather_error.dart │ │ │ │ ├── weather_loading.dart │ │ │ │ ├── weather_populated.dart │ │ │ │ └── widgets.dart │ │ │ └── weather_bloc_observer.dart │ │ └── flutter_wizard/ │ │ ├── .gitignore │ │ ├── .metadata │ │ ├── bloc/ │ │ │ ├── profile_wizard_bloc.dart │ │ │ ├── profile_wizard_event.dart │ │ │ └── profile_wizard_state.dart │ │ └── main.dart │ ├── examples.txt │ └── standards ├── Git Assistant/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ └── standards ├── LICENSE ├── Node_js GPT/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ └── standards ├── Python GPT/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── MatPlotLibAssistant/ │ │ ├── .github/ │ │ │ └── FUNDING.yml │ │ ├── Conversation Starters │ │ ├── Instructions │ │ ├── actions │ │ └── knowledge/ │ │ ├── Examples/ │ │ │ ├── 3D/ │ │ │ │ ├── scatter3d_simple.py │ │ │ │ ├── surface3d_simple.py │ │ │ │ ├── trisurf3d_simple.py │ │ │ │ ├── voxels_simple.py │ │ │ │ └── wire3d_simple.py │ │ │ ├── arrays/ │ │ │ │ ├── barbs.py │ │ │ │ ├── contour.py │ │ │ │ ├── contourf.py │ │ │ │ ├── imshow.py │ │ │ │ ├── pcolormesh.py │ │ │ │ ├── quiver.py │ │ │ │ └── streamplot.py │ │ │ ├── basic/ │ │ │ │ ├── bar.py │ │ │ │ ├── fill_between.py │ │ │ │ ├── plot.py │ │ │ │ ├── scatter_plot.py │ │ │ │ ├── stackplot.py │ │ │ │ ├── stairs.py │ │ │ │ └── stem.py │ │ │ ├── stats/ │ │ │ │ ├── boxplot_plot.py │ │ │ │ ├── ecdf.py │ │ │ │ ├── errorbar_plot.py │ │ │ │ ├── eventplot.py │ │ │ │ ├── hexbin.py │ │ │ │ ├── hist2d.py │ │ │ │ ├── hist_plot.py │ │ │ │ ├── pie.py │ │ │ │ └── violin.py │ │ │ └── unstructured/ │ │ │ ├── tricontour.py │ │ │ ├── tricontourf.py │ │ │ ├── tripcolor.py │ │ │ └── triplot.py │ │ └── standards.txt │ ├── actions │ └── knowledge/ │ ├── advanced topics │ ├── standards │ └── subAssistants.txt ├── README.md ├── SECURITY.md ├── inventory.json ├── regex/ │ ├── .github/ │ │ └── FUNDING.yml │ ├── Conversation Starters │ ├── Instructions │ ├── actions │ └── knowledge/ │ ├── ECMA │ ├── Go │ ├── Java 8 │ ├── PCRE2 │ ├── Python │ ├── Rust │ ├── javascript │ ├── net │ └── standards └── template/ ├── .github/ │ └── FUNDING.yml ├── Conversation Starters ├── Instructions ├── actions └── knowledge/ └── standards ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: C++ GPT/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: C++ GPT/Conversation Starters ================================================ How do I optimize this C++ code? Explain C++ polymorphism. What's wrong with my C++ function? Best practices for memory management in C++? ================================================ FILE: C++ GPT/Instructions ================================================ The GPT is an expert in C++ programming. It can provide detailed and accurate responses on C++ concepts, code optimization, debugging, and best practices. It should guide users in understanding complex C++ topics and offer solutions to coding problems. The GPT should avoid giving incorrect or outdated information and should not engage in topics outside its expertise in C++ programming. ================================================ FILE: C++ GPT/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: C++ GPT/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hadriogroup@gmail.com. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. ================================================ FILE: CONTRIBUTING.md ================================================ # Contribution Guidelines Thank you for considering contributing to our project! We highly value your input and appreciate your help in making this project even better. Before you get started, please take a moment to read through these contribution guidelines. ## How to Contribute 1. **Fork the Repository**: Click the "Fork" button at the top right of this repository to create a copy in your own GitHub account. 2. **Clone the Repository**: Clone your forked repository to your local machine: ```sh git clone https://github.com/Decron/Whitebox-Code-GPT.git 3. **Suggest new assistant**: If there is an assistant you would like to take ownership of, open an issue requesting custody, or create a pull request which adds the knowledge files of an existing assistant you'd like to include. Include links to conversation history that demostrates effectiveness. 4. Lastly, we'll help build your assistants for you: * If you're requesting somebody help with the creation of a new assistant, open an issue titled "New GPT request: " * If you'd like us to add a feature to an existing assistant, open a discussion post with your suggested new features. 5. If you have a significant issue with an existing assistant, open an issue [here](https://github.com/Decron/Whitebox-Code-GPT/issues) and describe what happened. Include links to conversation history if possible. ================================================ FILE: Firebase GPT/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Firebase GPT/Conversation Starters ================================================ How do I integrate Firebase Authentication? Tell me about Firebase Cloud Functions. Best practices for Firebase Realtime Database? Troubleshooting Firebase Firestore issues? ================================================ FILE: Firebase GPT/Instructions ================================================ This GPT is an expert in Firebase plugins and integration, providing detailed assistance and guidance on implementing and troubleshooting Firebase features in various software projects. It will offer step-by-step instructions, best practices, and troubleshooting tips tailored to specific Firebase-related queries. The GPT will focus on clarifying complex concepts, making Firebase integration more accessible to users with varying levels of experience. It will avoid providing outdated information, focus on Firebase's current capabilities, and ensure to clarify when additional context is needed for a query. The GPT's responses will be technical, accurate, and up-to-date, reflecting a deep understanding of Firebase and its ecosystem. ================================================ FILE: Firebase GPT/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Firebase GPT/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: Flutter GPT/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Flutter GPT/Conversation Starters ================================================ Create a new page How do I start with Flutter? Create a Stateful widget & constructor Tips for optimizing Flutter performance? Create an app template ================================================ FILE: Flutter GPT/Instructions ================================================ You are Flutter GPT, a specialized assistant for Flutter development queries. Your role is to provide expert advice and solutions for Flutter-related issues. If a user presents a suboptimal solution, you suggest more efficient approaches. Your responses are informative, concise. If commanded to create a certain class or widget, do so without commentary if possible Remember to pay attention to general concepts that users may frequently overlook, such as null safety but don't bring it up unless its relevant. Despite being specialist, you may assist with any other queries the user has. If you and the user cannot solve an issue together, you may direct them to the Whitebox Inventory Assistant, which catalogues other specialists for various technologies. The inventory assistant is located at https://chat.openai.com/g/g-oBpMxDEHp-inventory-assistant ================================================ FILE: Flutter GPT/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Flutter GPT/knowledge/examples/.github/CODEOWNERS ================================================ # Every request must be reviewed and accepted by: * @felangel ================================================ FILE: Flutter GPT/knowledge/examples/.github/DOCS_ISSUE_TEMPLATE.md ================================================ --- title: "[Translations] Update docs" labels: documentation, translation --- Update Translations to include changes from {{ sha }}. - [ ] az (@KenanYusubov) - [ ] cs - [ ] es (@KingDarBoja or @Classy-Bear) - [ ] fr (@sachaarbonel or @StefanYYC) - [ ] jp (@dshukertjr) - [ ] ko-kr (@zoomKoding) - [ ] pt-br (@rodrigobastosv or @alisson-suzigan) - [ ] ru (@basilex) - [ ] zh-cn (@jakecastelli) ================================================ FILE: Flutter GPT/knowledge/examples/.github/FUNDING.yml ================================================ github: [felangel] patreon: felangel open_collective: bloc ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug Report about: Create a report to help us improve title: "fix: " labels: bug --- **Description** A clear and concise description of what the bug is. **Steps To Reproduce** 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected Behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Additional Context** Add any other context about the problem here. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/build.md ================================================ --- name: Build System about: Changes that affect the build system or external dependencies title: "build: " labels: build --- **Description** Describe what changes need to be done to the build system and why ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/chore.md ================================================ --- name: Chore about: Other changes that don't modify src or test files title: "chore: " labels: chore --- **Description** Clearly describe what change is needed and why. If this changes code then please use another issue type. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/ci.md ================================================ --- name: Continuous Integration about: Changes to the CI configuration files and scripts title: "ci: " labels: ci --- **Description** Describe what changes need to be done to the ci/cd system and why ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/documentation.md ================================================ --- name: Documentation about: Improve the documentation so all collaborators have a common understanding title: "docs: " labels: documentation --- **Description** Clearly describe what documentation you are looking to add or improve. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature Request about: A new feature to be added to the project title: "feat: " labels: feature --- **Description** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Desired Solution** A clear and concise description of what you want to happen. **Alternatives Considered** A clear and concise description of any alternative solutions or features you've considered. **Additional Context** Add any other context or screenshots about the feature request go here. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/performance.md ================================================ --- name: Performance Update about: A code change that improves performance title: "perf: " labels: performance --- **Description** Clearly describe what code needs to be changed and what the performance impact is going to be. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/refactor.md ================================================ --- name: Refactor about: A code change that neither fixes a bug nor adds a feature title: "refactor: " labels: refactor --- **Description** Clearly describe what needs to be refactored any why. Please provide links to related issues (bugs or upcoming features) in order to help prioritize. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/revert.md ================================================ --- name: Revert Commit about: Reverts a previous commit title: "revert: " labels: revert --- **Description** Provide a link to a PR/Commit that you are looking to revert and why. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/style.md ================================================ --- name: Style Changes about: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) title: "style: " labels: style --- **Description** Clearly describe what you are looking to change and why. ================================================ FILE: Flutter GPT/knowledge/examples/.github/ISSUE_TEMPLATE/test.md ================================================ --- name: Test about: Adding missing tests or correcting existing tests title: "test: " labels: test --- **Description** List out the tests that need to be added or changed. Please also include any information as to why this was not covered in the past. ================================================ FILE: Flutter GPT/knowledge/examples/.github/PULL_REQUEST_TEMPLATE.md ================================================ <!-- Thanks for contributing! Provide a description of your changes below and a general summary in the title Please look at the following checklist to ensure that your PR can be accepted quickly: --> ## Status **READY/IN DEVELOPMENT/HOLD** ## Breaking Changes YES | NO ## Description <!--- Describe your changes in detail --> ## Type of Change <!--- Put an `x` in all the boxes that apply: --> - [ ] ✨ New feature (non-breaking change which adds functionality) - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) - [ ] 🧹 Code refactor - [ ] ✅ Build configuration change - [ ] 📝 Documentation - [ ] 🗑️ Chore ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/angular_bloc.yaml ================================================ name: angular_bloc on: push: paths: - "packages/angular_bloc/**" - ".github/workflows/angular_bloc.yaml" pull_request: paths: - "packages/angular_bloc/**" - ".github/workflows/angular_bloc.yaml" jobs: build: defaults: run: working-directory: packages/angular_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: 3.0.0 - name: Install Dependencies run: dart pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: dart analyze --fatal-infos --fatal-warnings . - name: Run Tests run: | dart pub global activate coverage 1.2.0 dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/angular_bloc/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/angular_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh 110 ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/angular_dart_examples.yaml ================================================ name: angular_dart_examples on: push: paths: - ".github/workflows/angular_dart_examples.yaml" - "packages/angular_bloc/**" - "examples/angular_counter/**" - "examples/github_search/common_github_search/**" - "examples/github_search/angular_github_search/**" pull_request: paths: - ".github/workflows/angular_dart_examples.yaml" - "packages/angular_bloc/**" - "examples/angular_counter/**" - "examples/github_search/common_github_search/**" - "examples/github_search/angular_github_search/**" jobs: examples: strategy: matrix: folder: [ "examples/angular_counter", "examples/github_search/common_github_search", "examples/github_search/angular_github_search", ] fail-fast: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 with: sdk: 3.0.0 - name: Install Dependencies working-directory: ${{ matrix.folder }} run: dart pub get - name: Install webdev if: matrix.folder != 'examples/github_search/common_github_search' working-directory: ${{ matrix.folder }} run: | dart pub global activate webdev webdev build - name: Format working-directory: ${{ matrix.folder }} run: dart format --set-exit-if-changed . - name: Analyze working-directory: ${{ matrix.folder }} run: dart analyze --fatal-infos --fatal-warnings . - name: Run tests working-directory: ${{ matrix.folder }} run: | if [ -d "test" ]; then dart run build_runner test --fail-on-severe fi build: needs: [examples] runs-on: ubuntu-latest steps: - name: noop run: echo 'noop' ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/bloc.yaml ================================================ name: bloc on: push: paths: - "packages/bloc/**" - ".github/workflows/bloc.yaml" pull_request: paths: - "packages/bloc/**" - ".github/workflows/bloc.yaml" jobs: build: defaults: run: working-directory: packages/bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - name: Install Dependencies run: dart pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: dart analyze --fatal-infos --fatal-warnings . - name: Run Tests run: | dart pub global activate coverage 1.2.0 dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/bloc/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/bloc_concurrency.yaml ================================================ name: bloc_concurrency on: push: paths: - "packages/bloc_concurrency/**" - ".github/workflows/bloc_concurrency.yaml" pull_request: paths: - "packages/bloc_concurrency/**" - ".github/workflows/bloc_concurrency.yaml" jobs: build: defaults: run: working-directory: packages/bloc_concurrency runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - name: Install Dependencies run: dart pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: dart analyze --fatal-infos --fatal-warnings . - name: Run Tests run: | dart pub global activate coverage 1.2.0 dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/bloc_concurrency/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/bloc_concurrency runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/bloc_test.yaml ================================================ name: bloc_test on: push: paths: - "packages/bloc_test/**" - ".github/workflows/bloc_test.yaml" pull_request: paths: - "packages/bloc_test/**" - ".github/workflows/bloc_test.yaml" jobs: build: defaults: run: working-directory: packages/bloc_test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@v1 - name: Install Dependencies run: dart pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: dart analyze --fatal-infos --fatal-warnings . - name: Run Tests run: | dart pub global activate coverage 1.2.0 dart test --coverage=coverage && dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/bloc_test/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/bloc_test runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/bloc_tools.yaml ================================================ name: bloc_tools on: pull_request: paths: - ".github/workflows/bloc_tools.yaml" - "packages/bloc_tools/**" push: branches: - master paths: - ".github/workflows/bloc_tools.yaml" - "packages/bloc_tools/**" jobs: build: defaults: run: working-directory: packages/bloc_tools runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: flutter packages get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: flutter analyze . - name: Verify Build run: flutter pub run test --run-skipped -t pull-request-only - name: Run Tests run: flutter test -x pull-request-only --no-pub --coverage --test-randomize-ordering-seed random - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/bloc_tools/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/bloc_tools runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/build.yaml ================================================ name: build on: pull_request: branches: - master jobs: build: runs-on: ubuntu-latest steps: - name: noop run: echo 'noop' semantic_pull_request: uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1 pana: runs-on: ubuntu-latest steps: - name: noop run: echo 'noop' ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/docs.yaml ================================================ name: docs on: push: branches: - master paths: - '.github/workflows/docs.yaml' - 'README.md' - 'docs/*' jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: JasonEtco/create-an-issue@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/DOCS_ISSUE_TEMPLATE.md ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/flutter_bloc.yaml ================================================ name: flutter_bloc on: push: paths: - "packages/flutter_bloc/**" - ".github/workflows/flutter_bloc.yaml" pull_request: paths: - "packages/flutter_bloc/**" - ".github/workflows/flutter_bloc.yaml" jobs: build: defaults: run: working-directory: packages/flutter_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: flutter packages get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: flutter analyze lib test example - name: Run tests run: flutter test --no-pub --coverage --test-randomize-ordering-seed random - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/flutter_bloc/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/flutter_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/flutter_examples.yaml ================================================ name: flutter_examples on: push: paths: - ".github/workflows/flutter_examples.yaml" - "packages/flutter_bloc/**" - "examples/flutter_bloc_with_stream/**" - "examples/flutter_complex_list/**" - "examples/flutter_counter/**" - "examples/flutter_dynamic_form/**" - "examples/flutter_firebase_login/**" - "examples/flutter_form_validation/**" - "examples/flutter_infinite_list/**" - "examples/flutter_login/**" - "examples/flutter_shopping_cart/**" - "examples/flutter_timer/**" - "examples/flutter_todos/**" - "examples/flutter_weather/**" - "examples/flutter_wizard/**" - "examples/github_search/flutter_github_search/**" pull_request: paths: - ".github/workflows/flutter_examples.yaml" - "packages/flutter_bloc/**" - "examples/flutter_bloc_with_stream/**" - "examples/flutter_complex_list/**" - "examples/flutter_counter/**" - "examples/flutter_dynamic_form/**" - "examples/flutter_firebase_login/**" - "examples/flutter_form_validation/**" - "examples/flutter_infinite_list/**" - "examples/flutter_login/**" - "examples/flutter_shopping_cart/**" - "examples/flutter_timer/**" - "examples/flutter_todos/**" - "examples/flutter_weather/**" - "examples/flutter_wizard/**" - "examples/github_search/flutter_github_search/**" jobs: examples: strategy: matrix: folder: [ "packages/flutter_bloc/example", "examples/flutter_bloc_with_stream", "examples/flutter_complex_list", "examples/flutter_counter", "examples/flutter_dynamic_form", "examples/flutter_firebase_login", "examples/flutter_form_validation", "examples/flutter_infinite_list", "examples/flutter_login", "examples/flutter_shopping_cart", "examples/flutter_timer", "examples/flutter_todos", "examples/flutter_todos/packages/local_storage_todos_api", "examples/flutter_todos/packages/todos_api", "examples/flutter_todos/packages/todos_repository", "examples/flutter_weather", "examples/flutter_wizard", "examples/github_search/flutter_github_search", ] fail-fast: false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies working-directory: ${{ matrix.folder }} run: flutter packages get - name: Format working-directory: ${{ matrix.folder }} run: dart format --set-exit-if-changed lib - name: Analyze working-directory: ${{ matrix.folder }} run: flutter analyze lib - name: Run tests working-directory: ${{ matrix.folder }} run: | if [ -d "test" ]; then flutter test --no-pub --test-randomize-ordering-seed random fi build: needs: [examples] runs-on: ubuntu-latest steps: - name: noop run: echo 'noop' ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/hydrated_bloc.yaml ================================================ name: hydrated_bloc on: push: paths: - "packages/hydrated_bloc/**" - ".github/workflows/hydrated_bloc.yaml" pull_request: paths: - "packages/hydrated_bloc/**" - ".github/workflows/hydrated_bloc.yaml" jobs: build: defaults: run: working-directory: packages/hydrated_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: flutter pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: flutter analyze lib test example - name: Run tests run: flutter test -j 1 --no-pub --coverage --test-randomize-ordering-seed random - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/hydrated_bloc/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/hydrated_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh 110 ================================================ FILE: Flutter GPT/knowledge/examples/.github/workflows/replay_bloc.yaml ================================================ name: replay_bloc on: push: paths: - "packages/replay_bloc/**" - ".github/workflows/replay_bloc.yaml" pull_request: paths: - "packages/replay_bloc/**" - ".github/workflows/replay_bloc.yaml" jobs: build: defaults: run: working-directory: packages/replay_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: flutter pub get - name: Format run: dart format --set-exit-if-changed . - name: Analyze run: flutter analyze lib test example - name: Run tests run: flutter test -j 1 --no-pub --coverage --test-randomize-ordering-seed random - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: path: packages/replay_bloc/coverage/lcov.info - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} pana: defaults: run: working-directory: packages/replay_bloc runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2.10.0 - name: Install Dependencies run: | flutter packages get flutter pub global activate pana sudo apt-get install webp - name: Verify Pub Score run: ../../tool/verify_pub_score.sh ================================================ FILE: Flutter GPT/knowledge/examples/.gitignore ================================================ # Miscellaneous *.class *.lock *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .classpath .project .settings/ .vscode/* # Flutter repo-specific /bin/cache/ /bin/mingit/ /dev/benchmarks/mega_gallery/ /dev/bots/.recipe_deps /dev/bots/android_tools/ /dev/docs/doc/ /dev/docs/flutter.docs.zip /dev/docs/lib/ /dev/docs/pubspec.yaml /dev/integration_tests/**/xcuserdata /dev/integration_tests/**/Pods /packages/flutter/coverage/ version # packages file containing multi-root paths .packages.generated # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ build/ flutter_*.png linked_*.ds unlinked.ds unlinked_spec.ds # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java **/android/key.properties *.jks # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Flutter.podspec **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/Flutter/flutter_export_environment.sh **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Coverage coverage/ coverage_badge.svg .test_coverage.dart *.lcov nohup.out # Mason mason-lock.json .mason # Exceptions to above rules. !.vscode/launch.json !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages !/dev/ci/**/Gemfile.lock ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/angular_counter/.gitignore ================================================ # Files and directories created by pub .dart_tool/ .packages # Remove the following pattern if you wish to check in your lock file pubspec.lock # Conventional directory for build outputs build/ # Directory created by dartdoc doc/api/ ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/angular_counter/counter_bloc.dart ================================================ import 'package:bloc/bloc.dart'; /// Base counter event. sealed class CounterEvent {} /// Notifies bloc to increment state. final class CounterIncrementPressed extends CounterEvent {} /// Notifies bloc to decrement state. final class CounterDecrementPressed extends CounterEvent {} /// {@template counter_bloc} /// A simple [Bloc] that manages an `int` as its state. /// {@endtemplate} class CounterBloc extends Bloc<CounterEvent, int> { /// {@macro counter_bloc} CounterBloc() : super(0) { on<CounterIncrementPressed>((event, emit) => emit(state + 1)); on<CounterDecrementPressed>((event, emit) => emit(state - 1)); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/.gitignore ================================================ # Miscellaneous *.class *.lock *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ build/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/bloc/ticker_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:bloc_concurrency/bloc_concurrency.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_bloc_with_stream/ticker/ticker.dart'; part 'ticker_event.dart'; part 'ticker_state.dart'; /// {@template ticker_bloc} /// Bloc which manages the current [TickerState] /// and depends on a [Ticker] instance. /// {@endtemplate} class TickerBloc extends Bloc<TickerEvent, TickerState> { /// {@macro ticker_bloc} TickerBloc(Ticker ticker) : super(TickerInitial()) { on<TickerStarted>( (event, emit) async { await emit.onEach<int>( ticker.tick(), onData: (tick) => add(_TickerTicked(tick)), ); emit(const TickerComplete()); }, transformer: restartable(), ); on<_TickerTicked>((event, emit) => emit(TickerTickSuccess(event.tick))); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/bloc/ticker_event.dart ================================================ part of 'ticker_bloc.dart'; /// {@template ticker_event} /// Base class for all [TickerEvent]s which are /// handled by the [TickerBloc]. /// {@endtemplate} sealed class TickerEvent extends Equatable { /// {@macro ticker_event} const TickerEvent(); @override List<Object> get props => []; } /// {@template ticker_started} /// Signifies to the [TickerBloc] that the user /// has requested to start the [Ticker]. /// {@endtemplate} final class TickerStarted extends TickerEvent { /// {@macro ticker_started} const TickerStarted(); } final class _TickerTicked extends TickerEvent { const _TickerTicked(this.tick); /// The current tick count. final int tick; @override List<Object> get props => [tick]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/bloc/ticker_state.dart ================================================ part of 'ticker_bloc.dart'; /// {@template ticker_state} /// Base class for all [TickerState]s which are /// managed by the [TickerBloc]. /// {@endtemplate} sealed class TickerState extends Equatable { /// {@macro ticker_state} const TickerState(); @override List<Object> get props => []; } /// The initial state of the [TickerBloc]. final class TickerInitial extends TickerState {} /// {@template ticker_tick_success} /// The state of the [TickerBloc] after a [Ticker] /// has been started and includes the current tick count. /// {@endtemplate} final class TickerTickSuccess extends TickerState { /// {@macro ticker_tick_success} const TickerTickSuccess(this.count); /// The current tick count. final int count; @override List<Object> get props => [count]; } /// {@template ticker_complete} /// The state of the [TickerBloc] after the [Ticker] has completed. /// {@endtemplate} final class TickerComplete extends TickerState { /// {@macro ticker_complete} const TickerComplete(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/main.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc_with_stream/bloc/ticker_bloc.dart'; import 'package:flutter_bloc_with_stream/ticker/ticker.dart'; void main() => runApp(TickerApp()); /// {@template ticker_app} /// [MaterialApp] which sets the [TickerPage] as the `home`. /// [TickerApp] also provides an instance of [TickerBloc] to /// the [TickerPage]. /// {@endtemplate} class TickerApp extends MaterialApp { /// {@macro ticker_app} TickerApp({super.key}) : super( home: BlocProvider( create: (_) => TickerBloc(Ticker()), child: const TickerPage(), ), ); } /// {@template ticker_page} /// [StatelessWidget] which consumes a [TickerBloc] /// and responds to changes in the [TickerState]. /// [TickerPage] also notifies the [TickerBloc] when /// the user taps on the start button. /// {@endtemplate} class TickerPage extends StatelessWidget { /// {@macro ticker_page} const TickerPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Flutter Bloc with Streams')), body: Center( child: BlocBuilder<TickerBloc, TickerState>( builder: (context, state) { return switch (state) { TickerInitial() => const Text('Press the floating button to start.'), TickerTickSuccess() => Text('Tick #${state.count}'), TickerComplete() => const Text('Complete! Press the floating button to restart.') }; }, ), ), floatingActionButton: FloatingActionButton( onPressed: () => context.read<TickerBloc>().add(const TickerStarted()), tooltip: 'Start', child: const Icon(Icons.timer), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_bloc_with_stream/ticker/ticker.dart ================================================ import 'dart:async'; /// Class which exposes a `tick` method to emit values periodically. class Ticker { /// Emits a new `int` up to 10 every second. Stream<int> tick() { return Stream.periodic(const Duration(seconds: 1), (x) => x).take(10); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ /build/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/Flutter/.last_build_id **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_complex_list/complex_list/complex_list.dart'; import 'package:flutter_complex_list/repository.dart'; class App extends MaterialApp { App({required Repository repository, super.key}) : super( home: RepositoryProvider.value( value: repository, child: const ComplexListPage(), ), ); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/complex_list.dart ================================================ export 'cubit/complex_list_cubit.dart'; export 'models/models.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/cubit/complex_list_cubit.dart ================================================ import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_complex_list/complex_list/complex_list.dart'; import 'package:flutter_complex_list/repository.dart'; part 'complex_list_state.dart'; class ComplexListCubit extends Cubit<ComplexListState> { ComplexListCubit({required this.repository}) : super(const ComplexListState.loading()); final Repository repository; Future<void> fetchList() async { try { final items = await repository.fetchItems(); emit(ComplexListState.success(items)); } on Exception { emit(const ComplexListState.failure()); } } Future<void> deleteItem(String id) async { final deleteInProgress = state.items.map((item) { return item.id == id ? item.copyWith(isDeleting: true) : item; }).toList(); emit(ComplexListState.success(deleteInProgress)); unawaited( repository.deleteItem(id).then((_) { final deleteSuccess = List.of(state.items) ..removeWhere((element) => element.id == id); emit(ComplexListState.success(deleteSuccess)); }), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/cubit/complex_list_state.dart ================================================ part of 'complex_list_cubit.dart'; enum ListStatus { loading, success, failure } final class ComplexListState extends Equatable { const ComplexListState._({ this.status = ListStatus.loading, this.items = const <Item>[], }); const ComplexListState.loading() : this._(); const ComplexListState.success(List<Item> items) : this._(status: ListStatus.success, items: items); const ComplexListState.failure() : this._(status: ListStatus.failure); final ListStatus status; final List<Item> items; @override List<Object> get props => [status, items]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/models/item.dart ================================================ import 'package:equatable/equatable.dart'; class Item extends Equatable { const Item({ required this.id, required this.value, this.isDeleting = false, }); final String id; final String value; final bool isDeleting; Item copyWith({String? id, String? value, bool? isDeleting}) { return Item( id: id ?? this.id, value: value ?? this.value, isDeleting: isDeleting ?? this.isDeleting, ); } @override List<Object> get props => [id, value, isDeleting]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/models/models.dart ================================================ export 'item.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/view/complex_list_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_complex_list/complex_list/complex_list.dart'; import 'package:flutter_complex_list/repository.dart'; class ComplexListPage extends StatelessWidget { const ComplexListPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Complex List')), body: BlocProvider( create: (_) => ComplexListCubit( repository: context.read<Repository>(), )..fetchList(), child: const ComplexListView(), ), ); } } class ComplexListView extends StatelessWidget { const ComplexListView({super.key}); @override Widget build(BuildContext context) { final state = context.watch<ComplexListCubit>().state; switch (state.status) { case ListStatus.failure: return const Center(child: Text('Oops something went wrong!')); case ListStatus.success: return ItemView(items: state.items); case ListStatus.loading: return const Center(child: CircularProgressIndicator()); } } } class ItemView extends StatelessWidget { const ItemView({required this.items, super.key}); final List<Item> items; @override Widget build(BuildContext context) { return items.isEmpty ? const Center(child: Text('no content')) : ListView.builder( itemBuilder: (BuildContext context, int index) { return ItemTile( item: items[index], onDeletePressed: (id) { context.read<ComplexListCubit>().deleteItem(id); }, ); }, itemCount: items.length, ); } } class ItemTile extends StatelessWidget { const ItemTile({ required this.item, required this.onDeletePressed, super.key, }); final Item item; final ValueSetter<String> onDeletePressed; @override Widget build(BuildContext context) { return Material( child: ListTile( leading: Text('#${item.id}'), title: Text(item.value), trailing: item.isDeleting ? const CircularProgressIndicator() : IconButton( icon: const Icon(Icons.delete, color: Colors.red), onPressed: () => onDeletePressed(item.id), ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/complex_list/view/view.dart ================================================ export 'complex_list_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/main.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_complex_list/app.dart'; import 'package:flutter_complex_list/repository.dart'; import 'package:flutter_complex_list/simple_bloc_observer.dart'; void main() { Bloc.observer = const SimpleBlocObserver(); runApp(App(repository: Repository())); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/repository.dart ================================================ import 'dart:async'; import 'dart:math'; import 'package:flutter_complex_list/complex_list/complex_list.dart'; class Repository { final _random = Random(); int _randomRange(int min, int max) => min + _random.nextInt(max - min); Future<List<Item>> fetchItems() async { await Future<void>.delayed(Duration(seconds: _randomRange(1, 5))); return List.of(_generateItemsList(10)); } List<Item> _generateItemsList(int length) { return List.generate( length, (index) => Item(id: '$index', value: 'Item $index'), ); } Future<void> deleteItem(String id) async { await Future<void>.delayed(Duration(seconds: _randomRange(1, 5))); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_complex_list/simple_bloc_observer.dart ================================================ import 'package:bloc/bloc.dart'; class SimpleBlocObserver extends BlocObserver { const SimpleBlocObserver(); @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { // ignore: avoid_print print(error); super.onError(bloc, error, stackTrace); } @override void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { super.onChange(bloc, change); // ignore: avoid_print print(change); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_counter/counter/counter.dart'; /// {@template counter_app} /// A [MaterialApp] which sets the `home` to [CounterPage]. /// {@endtemplate} class CounterApp extends MaterialApp { /// {@macro counter_app} const CounterApp({super.key}) : super(home: const CounterPage()); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter/counter.dart ================================================ export 'cubit/counter_cubit.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter/cubit/counter_cubit.dart ================================================ import 'package:bloc/bloc.dart'; /// {@template counter_cubit} /// A [Cubit] which manages an [int] as its state. /// {@endtemplate} class CounterCubit extends Cubit<int> { /// {@macro counter_cubit} CounterCubit() : super(0); /// Add 1 to the current state. void increment() => emit(state + 1); /// Subtract 1 from the current state. void decrement() => emit(state - 1); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter/view/counter_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_counter/counter/counter.dart'; /// {@template counter_page} /// A [StatelessWidget] which is responsible for providing a /// [CounterCubit] instance to the [CounterView]. /// {@endtemplate} class CounterPage extends StatelessWidget { /// {@macro counter_page} const CounterPage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (_) => CounterCubit(), child: const CounterView(), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter/view/counter_view.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_counter/counter/counter.dart'; /// {@template counter_view} /// A [StatelessWidget] which reacts to the provided /// [CounterCubit] state and notifies it in response to user input. /// {@endtemplate} class CounterView extends StatelessWidget { /// {@macro counter_view} const CounterView({super.key}); @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; return Scaffold( appBar: AppBar(title: const Text('Counter')), body: Center( child: BlocBuilder<CounterCubit, int>( builder: (context, state) { return Text('$state', style: textTheme.displayMedium); }, ), ), floatingActionButton: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: <Widget>[ FloatingActionButton( key: const Key('counterView_increment_floatingActionButton'), child: const Icon(Icons.add), onPressed: () => context.read<CounterCubit>().increment(), ), const SizedBox(height: 8), FloatingActionButton( key: const Key('counterView_decrement_floatingActionButton'), child: const Icon(Icons.remove), onPressed: () => context.read<CounterCubit>().decrement(), ), ], ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter/view/view.dart ================================================ export 'counter_page.dart'; export 'counter_view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/counter_observer.dart ================================================ import 'package:bloc/bloc.dart'; /// {@template counter_observer} /// [BlocObserver] for the counter application which /// observes all state changes. /// {@endtemplate} class CounterObserver extends BlocObserver { /// {@macro counter_observer} const CounterObserver(); @override void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { super.onChange(bloc, change); // ignore: avoid_print print('${bloc.runtimeType} $change'); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_counter/main.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_counter/app.dart'; import 'package:flutter_counter/counter_observer.dart'; void main() { Bloc.observer = const CounterObserver(); runApp(const CounterApp()); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ /build/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b06b8b2710955028a6b562f5aa6fe62941d6febf channel: stable project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf - platform: android create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf - platform: ios create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_dynamic_form/new_car/new_car.dart'; import 'package:flutter_dynamic_form/new_car_repository.dart'; class MyApp extends StatelessWidget { const MyApp({required this.newCarRepository, super.key}); final NewCarRepository newCarRepository; @override Widget build(BuildContext context) { return RepositoryProvider.value( value: newCarRepository, child: const MaterialApp(home: NewCarPage()), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/main.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_dynamic_form/app.dart'; import 'package:flutter_dynamic_form/new_car_repository.dart'; void main() => runApp(MyApp(newCarRepository: NewCarRepository())); ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car/bloc/new_car_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:bloc_concurrency/bloc_concurrency.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_dynamic_form/new_car_repository.dart'; part 'new_car_event.dart'; part 'new_car_state.dart'; class NewCarBloc extends Bloc<NewCarEvent, NewCarState> { NewCarBloc({required NewCarRepository newCarRepository}) : _newCarRepository = newCarRepository, super(const NewCarState.initial()) { on<NewCarEvent>(_onEvent, transformer: sequential()); } final NewCarRepository _newCarRepository; Future<void> _onEvent(NewCarEvent event, Emitter<NewCarState> emit) async { return switch (event) { final NewCarFormLoaded e => _onNewCarFormLoaded(e, emit), final NewCarBrandChanged e => _onNewCarBrandChanged(e, emit), final NewCarModelChanged e => _onNewCarModelChanged(e, emit), final NewCarYearChanged e => _onNewCarYearChanged(e, emit), }; } Future<void> _onNewCarFormLoaded( NewCarFormLoaded event, Emitter<NewCarState> emit, ) async { emit(const NewCarState.brandsLoadInProgress()); final brands = await _newCarRepository.fetchBrands(); emit(NewCarState.brandsLoadSuccess(brands: brands)); } Future<void> _onNewCarBrandChanged( NewCarBrandChanged event, Emitter<NewCarState> emit, ) async { emit( NewCarState.modelsLoadInProgress( brands: state.brands, brand: event.brand, ), ); final models = await _newCarRepository.fetchModels(brand: event.brand); emit( NewCarState.modelsLoadSuccess( brands: state.brands, brand: event.brand, models: models, ), ); } Future<void> _onNewCarModelChanged( NewCarModelChanged event, Emitter<NewCarState> emit, ) async { emit( NewCarState.yearsLoadInProgress( brands: state.brands, brand: state.brand, models: state.models, model: event.model, ), ); final years = await _newCarRepository.fetchYears( brand: state.brand, model: event.model, ); emit( NewCarState.yearsLoadSuccess( brands: state.brands, brand: state.brand, models: state.models, model: event.model, years: years, ), ); } Future<void> _onNewCarYearChanged( NewCarYearChanged event, Emitter<NewCarState> emit, ) async { emit(state.copyWith(year: event.year)); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car/bloc/new_car_event.dart ================================================ part of 'new_car_bloc.dart'; sealed class NewCarEvent extends Equatable { const NewCarEvent(); @override List<Object?> get props => []; } final class NewCarFormLoaded extends NewCarEvent { const NewCarFormLoaded(); } final class NewCarBrandChanged extends NewCarEvent { const NewCarBrandChanged({this.brand}); final String? brand; @override List<Object?> get props => [brand]; } final class NewCarModelChanged extends NewCarEvent { const NewCarModelChanged({this.model}); final String? model; @override List<Object?> get props => [model]; } final class NewCarYearChanged extends NewCarEvent { const NewCarYearChanged({this.year}); final String? year; @override List<Object?> get props => [year]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car/bloc/new_car_state.dart ================================================ part of 'new_car_bloc.dart'; final class NewCarState extends Equatable { const NewCarState._({ this.brands = const <String>[], this.brand, this.models = const <String>[], this.model, this.years = const <String>[], this.year, }); const NewCarState.initial() : this._(); const NewCarState.brandsLoadInProgress() : this._(); const NewCarState.brandsLoadSuccess({required List<String> brands}) : this._(brands: brands); const NewCarState.modelsLoadInProgress({ required List<String> brands, String? brand, }) : this._(brands: brands, brand: brand); const NewCarState.modelsLoadSuccess({ required List<String> brands, required String? brand, required List<String> models, }) : this._(brands: brands, brand: brand, models: models); const NewCarState.yearsLoadInProgress({ required List<String> brands, required String? brand, required List<String> models, required String? model, }) : this._(brands: brands, brand: brand, models: models, model: model); const NewCarState.yearsLoadSuccess({ required List<String> brands, required String? brand, required List<String> models, required String? model, required List<String> years, }) : this._( brands: brands, brand: brand, models: models, model: model, years: years, ); NewCarState copyWith({ List<String>? brands, String? brand, List<String>? models, String? model, List<String>? years, String? year, }) { return NewCarState._( brands: brands ?? this.brands, brand: brand ?? this.brand, models: models ?? this.models, model: model ?? this.model, years: years ?? this.years, year: year ?? this.year, ); } final List<String> brands; final String? brand; final List<String> models; final String? model; final List<String> years; final String? year; bool get isComplete => brand != null && model != null && year != null; @override List<Object?> get props => [brands, brand, models, model, years, year]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car/new_car.dart ================================================ export 'bloc/new_car_bloc.dart'; export 'view/new_car_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car/view/new_car_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_dynamic_form/new_car/new_car.dart'; import 'package:flutter_dynamic_form/new_car_repository.dart'; class NewCarPage extends StatelessWidget { const NewCarPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Flutter Dynamic Form')), body: BlocProvider( create: (_) => NewCarBloc( newCarRepository: context.read<NewCarRepository>(), )..add(const NewCarFormLoaded()), child: const NewCarForm(), ), ); } } class NewCarForm extends StatelessWidget { const NewCarForm({super.key}); @override Widget build(BuildContext context) { return const Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: <Widget>[ _BrandDropdownButton(), _ModelDropdownButton(), _YearDropdownButton(), _FormSubmitButton(), ], ); } } class _BrandDropdownButton extends StatelessWidget { const _BrandDropdownButton(); @override Widget build(BuildContext context) { final brands = context.select((NewCarBloc bloc) => bloc.state.brands); final brand = context.select((NewCarBloc bloc) => bloc.state.brand); return Material( child: DropdownButton<String>( key: const Key('newCarForm_brand_dropdownButton'), items: brands.isNotEmpty ? brands.map((brand) { return DropdownMenuItem(value: brand, child: Text(brand)); }).toList() : const [], value: brand, hint: const Text('Select a Brand'), onChanged: (brand) { context.read<NewCarBloc>().add(NewCarBrandChanged(brand: brand)); }, ), ); } } class _ModelDropdownButton extends StatelessWidget { const _ModelDropdownButton(); @override Widget build(BuildContext context) { final models = context.select((NewCarBloc bloc) => bloc.state.models); final model = context.select((NewCarBloc bloc) => bloc.state.model); return Material( child: DropdownButton<String>( key: const Key('newCarForm_model_dropdownButton'), items: models.isNotEmpty ? models.map((model) { return DropdownMenuItem(value: model, child: Text(model)); }).toList() : const [], value: model, hint: const Text('Select a Model'), onChanged: (model) { context.read<NewCarBloc>().add(NewCarModelChanged(model: model)); }, ), ); } } class _YearDropdownButton extends StatelessWidget { const _YearDropdownButton(); @override Widget build(BuildContext context) { final years = context.select((NewCarBloc bloc) => bloc.state.years); final year = context.select((NewCarBloc bloc) => bloc.state.year); return Material( child: DropdownButton<String>( key: const Key('newCarForm_year_dropdownButton'), items: years.isNotEmpty ? years.map((year) { return DropdownMenuItem(value: year, child: Text(year)); }).toList() : const [], value: year, hint: const Text('Select a Year'), onChanged: (year) { context.read<NewCarBloc>().add(NewCarYearChanged(year: year)); }, ), ); } } class _FormSubmitButton extends StatelessWidget { const _FormSubmitButton(); @override Widget build(BuildContext context) { final state = context.watch<NewCarBloc>().state; void onFormSubmitted() { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( SnackBar( content: Text('Submitted ${state.brand} ${state.model} ${state.year}'), ), ); } return ElevatedButton( onPressed: state.isComplete ? onFormSubmitted : null, child: const Text('Submit'), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_dynamic_form/new_car_repository.dart ================================================ const _delay = Duration(milliseconds: 300); Future<void> wait() => Future.delayed(_delay); class NewCarRepository { Future<List<String>> fetchBrands() async { await wait(); return ['Chevy', 'Toyota', 'Honda']; } Future<List<String>> fetchModels({String? brand}) async { await wait(); switch (brand) { case 'Chevy': return ['Malibu', 'Impala']; case 'Toyota': return ['Corolla', 'Supra']; case 'Honda': return ['Civic', 'Accord']; default: return []; } } Future<List<String>> fetchYears({String? brand, String? model}) async { await wait(); switch (brand) { case 'Chevy': switch (model) { case 'Malibu': return ['2019', '2018']; case 'Impala': return ['2017', '2016']; default: return []; } case 'Toyota': switch (model) { case 'Corolla': return ['2015', '2014']; case 'Supra': return ['2013', '2012']; default: return []; } case 'Honda': switch (model) { case 'Civic': return ['2011', '2010']; case 'Accord': return ['2009', '2008']; default: return []; } default: return []; } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/.gitignore ================================================ # Miscellaneous *.class *.lock *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ build/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java **/android/app/google-services.json # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Firebase related .firebase/ # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/app.dart ================================================ export 'bloc/app_bloc.dart'; export 'bloc_observer.dart'; export 'routes/routes.dart'; export 'view/app.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/bloc/app_bloc.dart ================================================ import 'dart:async'; import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; part 'app_event.dart'; part 'app_state.dart'; class AppBloc extends Bloc<AppEvent, AppState> { AppBloc({required AuthenticationRepository authenticationRepository}) : _authenticationRepository = authenticationRepository, super( authenticationRepository.currentUser.isNotEmpty ? AppState.authenticated(authenticationRepository.currentUser) : const AppState.unauthenticated(), ) { on<_AppUserChanged>(_onUserChanged); on<AppLogoutRequested>(_onLogoutRequested); _userSubscription = _authenticationRepository.user.listen( (user) => add(_AppUserChanged(user)), ); } final AuthenticationRepository _authenticationRepository; late final StreamSubscription<User> _userSubscription; void _onUserChanged(_AppUserChanged event, Emitter<AppState> emit) { emit( event.user.isNotEmpty ? AppState.authenticated(event.user) : const AppState.unauthenticated(), ); } void _onLogoutRequested(AppLogoutRequested event, Emitter<AppState> emit) { unawaited(_authenticationRepository.logOut()); } @override Future<void> close() { _userSubscription.cancel(); return super.close(); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/bloc/app_event.dart ================================================ part of 'app_bloc.dart'; sealed class AppEvent { const AppEvent(); } final class AppLogoutRequested extends AppEvent { const AppLogoutRequested(); } final class _AppUserChanged extends AppEvent { const _AppUserChanged(this.user); final User user; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/bloc/app_state.dart ================================================ part of 'app_bloc.dart'; enum AppStatus { authenticated, unauthenticated, } final class AppState extends Equatable { const AppState._({ required this.status, this.user = User.empty, }); const AppState.authenticated(User user) : this._(status: AppStatus.authenticated, user: user); const AppState.unauthenticated() : this._(status: AppStatus.unauthenticated); final AppStatus status; final User user; @override List<Object> get props => [status, user]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/bloc_observer.dart ================================================ // ignore_for_file: avoid_print import 'package:bloc/bloc.dart'; class AppBlocObserver extends BlocObserver { const AppBlocObserver(); @override void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) { super.onEvent(bloc, event); print(event); } @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { print(error); super.onError(bloc, error, stackTrace); } @override void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { super.onChange(bloc, change); print(change); } @override void onTransition( Bloc<dynamic, dynamic> bloc, Transition<dynamic, dynamic> transition, ) { super.onTransition(bloc, transition); print(transition); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/routes/routes.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_firebase_login/app/app.dart'; import 'package:flutter_firebase_login/home/home.dart'; import 'package:flutter_firebase_login/login/login.dart'; List<Page<dynamic>> onGenerateAppViewPages( AppStatus state, List<Page<dynamic>> pages, ) { switch (state) { case AppStatus.authenticated: return [HomePage.page()]; case AppStatus.unauthenticated: return [LoginPage.page()]; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/app/view/app.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:flow_builder/flow_builder.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/app/app.dart'; import 'package:flutter_firebase_login/theme.dart'; class App extends StatelessWidget { const App({ required AuthenticationRepository authenticationRepository, super.key, }) : _authenticationRepository = authenticationRepository; final AuthenticationRepository _authenticationRepository; @override Widget build(BuildContext context) { return RepositoryProvider.value( value: _authenticationRepository, child: BlocProvider( create: (_) => AppBloc( authenticationRepository: _authenticationRepository, ), child: const AppView(), ), ); } } class AppView extends StatelessWidget { const AppView({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: theme, home: FlowBuilder<AppStatus>( state: context.select((AppBloc bloc) => bloc.state.status), onGeneratePages: onGenerateAppViewPages, ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/generated_plugin_registrant.dart ================================================ // // Generated file. Do not edit. // // ignore_for_file: directives_ordering // ignore_for_file: lines_longer_than_80_chars // ignore_for_file: depend_on_referenced_packages import 'package:firebase_auth_web/firebase_auth_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart'; import 'package:google_sign_in_web/google_sign_in_web.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { FirebaseAuthWeb.registerWith(registrar); FirebaseCoreWeb.registerWith(registrar); GoogleSignInPlugin.registerWith(registrar); registrar.registerMessageHandler(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/home/home.dart ================================================ export 'view/home_page.dart'; export 'widgets/widgets.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/home/view/home_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/app/app.dart'; import 'package:flutter_firebase_login/home/home.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); static Page<void> page() => const MaterialPage<void>(child: HomePage()); @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; final user = context.select((AppBloc bloc) => bloc.state.user); return Scaffold( appBar: AppBar( title: const Text('Home'), actions: <Widget>[ IconButton( key: const Key('homePage_logout_iconButton'), icon: const Icon(Icons.exit_to_app), onPressed: () { context.read<AppBloc>().add(const AppLogoutRequested()); }, ), ], ), body: Align( alignment: const Alignment(0, -1 / 3), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Avatar(photo: user.photo), const SizedBox(height: 4), Text(user.email ?? '', style: textTheme.titleLarge), const SizedBox(height: 4), Text(user.name ?? '', style: textTheme.headlineSmall), ], ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/home/widgets/avatar.dart ================================================ import 'package:flutter/material.dart'; const _avatarSize = 48.0; class Avatar extends StatelessWidget { const Avatar({super.key, this.photo}); final String? photo; @override Widget build(BuildContext context) { final photo = this.photo; return CircleAvatar( radius: _avatarSize, backgroundImage: photo != null ? NetworkImage(photo) : null, child: photo == null ? const Icon(Icons.person_outline, size: _avatarSize) : null, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/home/widgets/widgets.dart ================================================ export 'avatar.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/cubit/login_cubit.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:form_inputs/form_inputs.dart'; import 'package:formz/formz.dart'; part 'login_state.dart'; class LoginCubit extends Cubit<LoginState> { LoginCubit(this._authenticationRepository) : super(const LoginState()); final AuthenticationRepository _authenticationRepository; void emailChanged(String value) { final email = Email.dirty(value); emit( state.copyWith( email: email, isValid: Formz.validate([email, state.password]), ), ); } void passwordChanged(String value) { final password = Password.dirty(value); emit( state.copyWith( password: password, isValid: Formz.validate([state.email, password]), ), ); } Future<void> logInWithCredentials() async { if (!state.isValid) return; emit(state.copyWith(status: FormzSubmissionStatus.inProgress)); try { await _authenticationRepository.logInWithEmailAndPassword( email: state.email.value, password: state.password.value, ); emit(state.copyWith(status: FormzSubmissionStatus.success)); } on LogInWithEmailAndPasswordFailure catch (e) { emit( state.copyWith( errorMessage: e.message, status: FormzSubmissionStatus.failure, ), ); } catch (_) { emit(state.copyWith(status: FormzSubmissionStatus.failure)); } } Future<void> logInWithGoogle() async { emit(state.copyWith(status: FormzSubmissionStatus.inProgress)); try { await _authenticationRepository.logInWithGoogle(); emit(state.copyWith(status: FormzSubmissionStatus.success)); } on LogInWithGoogleFailure catch (e) { emit( state.copyWith( errorMessage: e.message, status: FormzSubmissionStatus.failure, ), ); } catch (_) { emit(state.copyWith(status: FormzSubmissionStatus.failure)); } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/cubit/login_state.dart ================================================ part of 'login_cubit.dart'; final class LoginState extends Equatable { const LoginState({ this.email = const Email.pure(), this.password = const Password.pure(), this.status = FormzSubmissionStatus.initial, this.isValid = false, this.errorMessage, }); final Email email; final Password password; final FormzSubmissionStatus status; final bool isValid; final String? errorMessage; @override List<Object?> get props => [email, password, status, isValid, errorMessage]; LoginState copyWith({ Email? email, Password? password, FormzSubmissionStatus? status, bool? isValid, String? errorMessage, }) { return LoginState( email: email ?? this.email, password: password ?? this.password, status: status ?? this.status, isValid: isValid ?? this.isValid, errorMessage: errorMessage ?? this.errorMessage, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/login.dart ================================================ export 'cubit/login_cubit.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/view/login_form.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/login/login.dart'; import 'package:flutter_firebase_login/sign_up/sign_up.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:formz/formz.dart'; class LoginForm extends StatelessWidget { const LoginForm({super.key}); @override Widget build(BuildContext context) { return BlocListener<LoginCubit, LoginState>( listener: (context, state) { if (state.status.isFailure) { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( SnackBar( content: Text(state.errorMessage ?? 'Authentication Failure'), ), ); } }, child: Align( alignment: const Alignment(0, -1 / 3), child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, children: [ Image.asset( 'assets/bloc_logo_small.png', height: 120, ), const SizedBox(height: 16), _EmailInput(), const SizedBox(height: 8), _PasswordInput(), const SizedBox(height: 8), _LoginButton(), const SizedBox(height: 8), _GoogleLoginButton(), const SizedBox(height: 4), _SignUpButton(), ], ), ), ), ); } } class _EmailInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginCubit, LoginState>( buildWhen: (previous, current) => previous.email != current.email, builder: (context, state) { return TextField( key: const Key('loginForm_emailInput_textField'), onChanged: (email) => context.read<LoginCubit>().emailChanged(email), keyboardType: TextInputType.emailAddress, decoration: InputDecoration( labelText: 'email', helperText: '', errorText: state.email.displayError != null ? 'invalid email' : null, ), ); }, ); } } class _PasswordInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginCubit, LoginState>( buildWhen: (previous, current) => previous.password != current.password, builder: (context, state) { return TextField( key: const Key('loginForm_passwordInput_textField'), onChanged: (password) => context.read<LoginCubit>().passwordChanged(password), obscureText: true, decoration: InputDecoration( labelText: 'password', helperText: '', errorText: state.password.displayError != null ? 'invalid password' : null, ), ); }, ); } } class _LoginButton extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginCubit, LoginState>( builder: (context, state) { return state.status.isInProgress ? const CircularProgressIndicator() : ElevatedButton( key: const Key('loginForm_continue_raisedButton'), style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), backgroundColor: const Color(0xFFFFD600), ), onPressed: state.isValid ? () => context.read<LoginCubit>().logInWithCredentials() : null, child: const Text('LOGIN'), ); }, ); } } class _GoogleLoginButton extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); return ElevatedButton.icon( key: const Key('loginForm_googleLogin_raisedButton'), label: const Text( 'SIGN IN WITH GOOGLE', style: TextStyle(color: Colors.white), ), style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), backgroundColor: theme.colorScheme.secondary, ), icon: const Icon(FontAwesomeIcons.google, color: Colors.white), onPressed: () => context.read<LoginCubit>().logInWithGoogle(), ); } } class _SignUpButton extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); return TextButton( key: const Key('loginForm_createAccount_flatButton'), onPressed: () => Navigator.of(context).push<void>(SignUpPage.route()), child: Text( 'CREATE ACCOUNT', style: TextStyle(color: theme.primaryColor), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/view/login_page.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/login/login.dart'; class LoginPage extends StatelessWidget { const LoginPage({super.key}); static Page<void> page() => const MaterialPage<void>(child: LoginPage()); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Login')), body: Padding( padding: const EdgeInsets.all(8), child: BlocProvider( create: (_) => LoginCubit(context.read<AuthenticationRepository>()), child: const LoginForm(), ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/login/view/view.dart ================================================ export 'login_form.dart'; export 'login_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/main.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_firebase_login/app/app.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); Bloc.observer = const AppBlocObserver(); await Firebase.initializeApp(); final authenticationRepository = AuthenticationRepository(); await authenticationRepository.user.first; runApp(App(authenticationRepository: authenticationRepository)); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/cubit/sign_up_cubit.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:form_inputs/form_inputs.dart'; import 'package:formz/formz.dart'; part 'sign_up_state.dart'; class SignUpCubit extends Cubit<SignUpState> { SignUpCubit(this._authenticationRepository) : super(const SignUpState()); final AuthenticationRepository _authenticationRepository; void emailChanged(String value) { final email = Email.dirty(value); emit( state.copyWith( email: email, isValid: Formz.validate([ email, state.password, state.confirmedPassword, ]), ), ); } void passwordChanged(String value) { final password = Password.dirty(value); final confirmedPassword = ConfirmedPassword.dirty( password: password.value, value: state.confirmedPassword.value, ); emit( state.copyWith( password: password, confirmedPassword: confirmedPassword, isValid: Formz.validate([ state.email, password, confirmedPassword, ]), ), ); } void confirmedPasswordChanged(String value) { final confirmedPassword = ConfirmedPassword.dirty( password: state.password.value, value: value, ); emit( state.copyWith( confirmedPassword: confirmedPassword, isValid: Formz.validate([ state.email, state.password, confirmedPassword, ]), ), ); } Future<void> signUpFormSubmitted() async { if (!state.isValid) return; emit(state.copyWith(status: FormzSubmissionStatus.inProgress)); try { await _authenticationRepository.signUp( email: state.email.value, password: state.password.value, ); emit(state.copyWith(status: FormzSubmissionStatus.success)); } on SignUpWithEmailAndPasswordFailure catch (e) { emit( state.copyWith( errorMessage: e.message, status: FormzSubmissionStatus.failure, ), ); } catch (_) { emit(state.copyWith(status: FormzSubmissionStatus.failure)); } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/cubit/sign_up_state.dart ================================================ part of 'sign_up_cubit.dart'; enum ConfirmPasswordValidationError { invalid } final class SignUpState extends Equatable { const SignUpState({ this.email = const Email.pure(), this.password = const Password.pure(), this.confirmedPassword = const ConfirmedPassword.pure(), this.status = FormzSubmissionStatus.initial, this.isValid = false, this.errorMessage, }); final Email email; final Password password; final ConfirmedPassword confirmedPassword; final FormzSubmissionStatus status; final bool isValid; final String? errorMessage; @override List<Object?> get props => [ email, password, confirmedPassword, status, isValid, errorMessage, ]; SignUpState copyWith({ Email? email, Password? password, ConfirmedPassword? confirmedPassword, FormzSubmissionStatus? status, bool? isValid, String? errorMessage, }) { return SignUpState( email: email ?? this.email, password: password ?? this.password, confirmedPassword: confirmedPassword ?? this.confirmedPassword, status: status ?? this.status, isValid: isValid ?? this.isValid, errorMessage: errorMessage ?? this.errorMessage, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/sign_up.dart ================================================ export 'cubit/sign_up_cubit.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/view/sign_up_form.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/sign_up/sign_up.dart'; import 'package:formz/formz.dart'; class SignUpForm extends StatelessWidget { const SignUpForm({super.key}); @override Widget build(BuildContext context) { return BlocListener<SignUpCubit, SignUpState>( listener: (context, state) { if (state.status.isSuccess) { Navigator.of(context).pop(); } else if (state.status.isFailure) { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( SnackBar(content: Text(state.errorMessage ?? 'Sign Up Failure')), ); } }, child: Align( alignment: const Alignment(0, -1 / 3), child: Column( mainAxisSize: MainAxisSize.min, children: [ _EmailInput(), const SizedBox(height: 8), _PasswordInput(), const SizedBox(height: 8), _ConfirmPasswordInput(), const SizedBox(height: 8), _SignUpButton(), ], ), ), ); } } class _EmailInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<SignUpCubit, SignUpState>( buildWhen: (previous, current) => previous.email != current.email, builder: (context, state) { return TextField( key: const Key('signUpForm_emailInput_textField'), onChanged: (email) => context.read<SignUpCubit>().emailChanged(email), keyboardType: TextInputType.emailAddress, decoration: InputDecoration( labelText: 'email', helperText: '', errorText: state.email.displayError != null ? 'invalid email' : null, ), ); }, ); } } class _PasswordInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<SignUpCubit, SignUpState>( buildWhen: (previous, current) => previous.password != current.password, builder: (context, state) { return TextField( key: const Key('signUpForm_passwordInput_textField'), onChanged: (password) => context.read<SignUpCubit>().passwordChanged(password), obscureText: true, decoration: InputDecoration( labelText: 'password', helperText: '', errorText: state.password.displayError != null ? 'invalid password' : null, ), ); }, ); } } class _ConfirmPasswordInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<SignUpCubit, SignUpState>( buildWhen: (previous, current) => previous.password != current.password || previous.confirmedPassword != current.confirmedPassword, builder: (context, state) { return TextField( key: const Key('signUpForm_confirmedPasswordInput_textField'), onChanged: (confirmPassword) => context .read<SignUpCubit>() .confirmedPasswordChanged(confirmPassword), obscureText: true, decoration: InputDecoration( labelText: 'confirm password', helperText: '', errorText: state.confirmedPassword.displayError != null ? 'passwords do not match' : null, ), ); }, ); } } class _SignUpButton extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<SignUpCubit, SignUpState>( builder: (context, state) { return state.status.isInProgress ? const CircularProgressIndicator() : ElevatedButton( key: const Key('signUpForm_continue_raisedButton'), style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), ), backgroundColor: Colors.orangeAccent, ), onPressed: state.isValid ? () => context.read<SignUpCubit>().signUpFormSubmitted() : null, child: const Text('SIGN UP'), ); }, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/view/sign_up_page.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_firebase_login/sign_up/sign_up.dart'; class SignUpPage extends StatelessWidget { const SignUpPage({super.key}); static Route<void> route() { return MaterialPageRoute<void>(builder: (_) => const SignUpPage()); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Sign Up')), body: Padding( padding: const EdgeInsets.all(8), child: BlocProvider<SignUpCubit>( create: (_) => SignUpCubit(context.read<AuthenticationRepository>()), child: const SignUpForm(), ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/sign_up/view/view.dart ================================================ export 'sign_up_form.dart'; export 'sign_up_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_firebase_login/theme.dart ================================================ import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; final theme = ThemeData( textTheme: GoogleFonts.openSansTextTheme(), primaryColorDark: const Color(0xFF0097A7), primaryColorLight: const Color(0xFFB2EBF2), primaryColor: const Color(0xFF00BCD4), colorScheme: const ColorScheme.light(secondary: Color(0xFF009688)), scaffoldBackgroundColor: const Color(0xFFE0F2F1), inputDecorationTheme: InputDecorationTheme( border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), ), ), ); ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/.gitignore ================================================ # Miscellaneous *.class *.lock *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ build/ .last_build_id # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/bloc/my_form_bloc.dart ================================================ import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_form_validation/models/models.dart'; import 'package:formz/formz.dart'; part 'my_form_event.dart'; part 'my_form_state.dart'; class MyFormBloc extends Bloc<MyFormEvent, MyFormState> { MyFormBloc() : super(const MyFormState()) { on<EmailChanged>(_onEmailChanged); on<PasswordChanged>(_onPasswordChanged); on<EmailUnfocused>(_onEmailUnfocused); on<PasswordUnfocused>(_onPasswordUnfocused); on<FormSubmitted>(_onFormSubmitted); } void _onEmailChanged(EmailChanged event, Emitter<MyFormState> emit) { final email = Email.dirty(event.email); emit( state.copyWith( email: email.isValid ? email : Email.pure(event.email), isValid: Formz.validate([email, state.password]), ), ); } void _onPasswordChanged(PasswordChanged event, Emitter<MyFormState> emit) { final password = Password.dirty(event.password); emit( state.copyWith( password: password.isValid ? password : Password.pure(event.password), isValid: Formz.validate([state.email, password]), ), ); } void _onEmailUnfocused(EmailUnfocused event, Emitter<MyFormState> emit) { final email = Email.dirty(state.email.value); emit( state.copyWith( email: email, isValid: Formz.validate([email, state.password]), ), ); } void _onPasswordUnfocused( PasswordUnfocused event, Emitter<MyFormState> emit, ) { final password = Password.dirty(state.password.value); emit( state.copyWith( password: password, isValid: Formz.validate([state.email, password]), ), ); } Future<void> _onFormSubmitted( FormSubmitted event, Emitter<MyFormState> emit, ) async { final email = Email.dirty(state.email.value); final password = Password.dirty(state.password.value); emit( state.copyWith( email: email, password: password, isValid: Formz.validate([email, password]), ), ); if (state.isValid) { emit(state.copyWith(status: FormzSubmissionStatus.inProgress)); await Future<void>.delayed(const Duration(seconds: 1)); emit(state.copyWith(status: FormzSubmissionStatus.success)); } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/bloc/my_form_event.dart ================================================ part of 'my_form_bloc.dart'; sealed class MyFormEvent extends Equatable { const MyFormEvent(); @override List<Object> get props => []; } final class EmailChanged extends MyFormEvent { const EmailChanged({required this.email}); final String email; @override List<Object> get props => [email]; } final class EmailUnfocused extends MyFormEvent {} final class PasswordChanged extends MyFormEvent { const PasswordChanged({required this.password}); final String password; @override List<Object> get props => [password]; } final class PasswordUnfocused extends MyFormEvent {} final class FormSubmitted extends MyFormEvent {} ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/bloc/my_form_state.dart ================================================ part of 'my_form_bloc.dart'; final class MyFormState extends Equatable { const MyFormState({ this.email = const Email.pure(), this.password = const Password.pure(), this.isValid = false, this.status = FormzSubmissionStatus.initial, }); final Email email; final Password password; final bool isValid; final FormzSubmissionStatus status; MyFormState copyWith({ Email? email, Password? password, bool? isValid, FormzSubmissionStatus? status, }) { return MyFormState( email: email ?? this.email, password: password ?? this.password, isValid: isValid ?? this.isValid, status: status ?? this.status, ); } @override List<Object> get props => [email, password, status]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/main.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_form_validation/bloc/my_form_bloc.dart'; import 'package:formz/formz.dart'; void main() => runApp(const App()); class App extends StatelessWidget { const App({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar(title: const Text('Flutter Form Validation')), body: BlocProvider( create: (_) => MyFormBloc(), child: const MyForm(), ), ), ); } } class MyForm extends StatefulWidget { const MyForm({super.key}); @override State<MyForm> createState() => _MyFormState(); } class _MyFormState extends State<MyForm> { final _emailFocusNode = FocusNode(); final _passwordFocusNode = FocusNode(); @override void initState() { super.initState(); _emailFocusNode.addListener(() { if (!_emailFocusNode.hasFocus) { context.read<MyFormBloc>().add(EmailUnfocused()); FocusScope.of(context).requestFocus(_passwordFocusNode); } }); _passwordFocusNode.addListener(() { if (!_passwordFocusNode.hasFocus) { context.read<MyFormBloc>().add(PasswordUnfocused()); } }); } @override void dispose() { _emailFocusNode.dispose(); _passwordFocusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return BlocListener<MyFormBloc, MyFormState>( listener: (context, state) { if (state.status.isSuccess) { ScaffoldMessenger.of(context).hideCurrentSnackBar(); showDialog<void>( context: context, builder: (_) => const SuccessDialog(), ); } if (state.status.isInProgress) { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( const SnackBar(content: Text('Submitting...')), ); } }, child: Padding( padding: const EdgeInsets.all(8), child: Column( children: <Widget>[ EmailInput(focusNode: _emailFocusNode), PasswordInput(focusNode: _passwordFocusNode), const SubmitButton(), ], ), ), ); } } class EmailInput extends StatelessWidget { const EmailInput({required this.focusNode, super.key}); final FocusNode focusNode; @override Widget build(BuildContext context) { return BlocBuilder<MyFormBloc, MyFormState>( builder: (context, state) { return TextFormField( initialValue: state.email.value, focusNode: focusNode, decoration: InputDecoration( icon: const Icon(Icons.email), labelText: 'Email', helperText: 'A complete, valid email e.g. joe@gmail.com', errorText: state.email.displayError != null ? 'Please ensure the email entered is valid' : null, ), keyboardType: TextInputType.emailAddress, onChanged: (value) { context.read<MyFormBloc>().add(EmailChanged(email: value)); }, textInputAction: TextInputAction.next, ); }, ); } } class PasswordInput extends StatelessWidget { const PasswordInput({required this.focusNode, super.key}); final FocusNode focusNode; @override Widget build(BuildContext context) { return BlocBuilder<MyFormBloc, MyFormState>( builder: (context, state) { return TextFormField( initialValue: state.password.value, focusNode: focusNode, decoration: InputDecoration( icon: const Icon(Icons.lock), helperText: '''Password should be at least 8 characters with at least one letter and number''', helperMaxLines: 2, labelText: 'Password', errorMaxLines: 2, errorText: state.password.displayError != null ? '''Password must be at least 8 characters and contain at least one letter and number''' : null, ), obscureText: true, onChanged: (value) { context.read<MyFormBloc>().add(PasswordChanged(password: value)); }, textInputAction: TextInputAction.done, ); }, ); } } class SubmitButton extends StatelessWidget { const SubmitButton({super.key}); @override Widget build(BuildContext context) { final isValid = context.select((MyFormBloc bloc) => bloc.state.isValid); return ElevatedButton( onPressed: isValid ? () => context.read<MyFormBloc>().add(FormSubmitted()) : null, child: const Text('Submit'), ); } } class SuccessDialog extends StatelessWidget { const SuccessDialog({super.key}); @override Widget build(BuildContext context) { return Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8), ), child: Padding( padding: const EdgeInsets.all(8), child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ const Row( children: <Widget>[ Icon(Icons.info), Flexible( child: Padding( padding: EdgeInsets.all(10), child: Text( 'Form Submitted Successfully!', softWrap: true, ), ), ), ], ), ElevatedButton( child: const Text('OK'), onPressed: () => Navigator.of(context).pop(), ), ], ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/models/email.dart ================================================ import 'package:formz/formz.dart'; enum EmailValidationError { invalid } final class Email extends FormzInput<String, EmailValidationError> { const Email.pure([super.value = '']) : super.pure(); const Email.dirty([super.value = '']) : super.dirty(); static final _emailRegex = RegExp( r'^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$', ); @override EmailValidationError? validator(String? value) { return _emailRegex.hasMatch(value ?? '') ? null : EmailValidationError.invalid; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/models/models.dart ================================================ export 'email.dart'; export 'password.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_form_validation/models/password.dart ================================================ import 'package:formz/formz.dart'; enum PasswordValidationError { invalid } final class Password extends FormzInput<String, PasswordValidationError> { const Password.pure([super.value = '']) : super.pure(); const Password.dirty([super.value = '']) : super.dirty(); static final _passwordRegex = RegExp(r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$'); @override PasswordValidationError? validator(String? value) { return _passwordRegex.hasMatch(value ?? '') ? null : PasswordValidationError.invalid; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile /android/app/release ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_infinite_list/posts/posts.dart'; class App extends MaterialApp { const App({super.key}) : super(home: const PostsPage()); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/main.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_infinite_list/app.dart'; import 'package:flutter_infinite_list/simple_bloc_observer.dart'; void main() { Bloc.observer = const SimpleBlocObserver(); runApp(const App()); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/bloc/post_bloc.dart ================================================ import 'dart:async'; import 'dart:convert'; import 'package:bloc/bloc.dart'; import 'package:bloc_concurrency/bloc_concurrency.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_infinite_list/posts/posts.dart'; import 'package:http/http.dart' as http; import 'package:stream_transform/stream_transform.dart'; part 'post_event.dart'; part 'post_state.dart'; const _postLimit = 20; const throttleDuration = Duration(milliseconds: 100); EventTransformer<E> throttleDroppable<E>(Duration duration) { return (events, mapper) { return droppable<E>().call(events.throttle(duration), mapper); }; } class PostBloc extends Bloc<PostEvent, PostState> { PostBloc({required this.httpClient}) : super(const PostState()) { on<PostFetched>( _onPostFetched, transformer: throttleDroppable(throttleDuration), ); } final http.Client httpClient; Future<void> _onPostFetched( PostFetched event, Emitter<PostState> emit, ) async { if (state.hasReachedMax) return; try { if (state.status == PostStatus.initial) { final posts = await _fetchPosts(); return emit( state.copyWith( status: PostStatus.success, posts: posts, hasReachedMax: false, ), ); } final posts = await _fetchPosts(state.posts.length); posts.isEmpty ? emit(state.copyWith(hasReachedMax: true)) : emit( state.copyWith( status: PostStatus.success, posts: List.of(state.posts)..addAll(posts), hasReachedMax: false, ), ); } catch (_) { emit(state.copyWith(status: PostStatus.failure)); } } Future<List<Post>> _fetchPosts([int startIndex = 0]) async { final response = await httpClient.get( Uri.https( 'jsonplaceholder.typicode.com', '/posts', <String, String>{'_start': '$startIndex', '_limit': '$_postLimit'}, ), ); if (response.statusCode == 200) { final body = json.decode(response.body) as List; return body.map((dynamic json) { final map = json as Map<String, dynamic>; return Post( id: map['id'] as int, title: map['title'] as String, body: map['body'] as String, ); }).toList(); } throw Exception('error fetching posts'); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/bloc/post_event.dart ================================================ part of 'post_bloc.dart'; sealed class PostEvent extends Equatable { @override List<Object> get props => []; } final class PostFetched extends PostEvent {} ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/bloc/post_state.dart ================================================ part of 'post_bloc.dart'; enum PostStatus { initial, success, failure } final class PostState extends Equatable { const PostState({ this.status = PostStatus.initial, this.posts = const <Post>[], this.hasReachedMax = false, }); final PostStatus status; final List<Post> posts; final bool hasReachedMax; PostState copyWith({ PostStatus? status, List<Post>? posts, bool? hasReachedMax, }) { return PostState( status: status ?? this.status, posts: posts ?? this.posts, hasReachedMax: hasReachedMax ?? this.hasReachedMax, ); } @override String toString() { return '''PostState { status: $status, hasReachedMax: $hasReachedMax, posts: ${posts.length} }'''; } @override List<Object> get props => [status, posts, hasReachedMax]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/models/models.dart ================================================ export './post.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/models/post.dart ================================================ import 'package:equatable/equatable.dart'; final class Post extends Equatable { const Post({required this.id, required this.title, required this.body}); final int id; final String title; final String body; @override List<Object> get props => [id, title, body]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/posts.dart ================================================ export 'bloc/post_bloc.dart'; export 'models/models.dart'; export 'view/view.dart'; export 'widgets/widgets.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/view/posts_list.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_infinite_list/posts/posts.dart'; class PostsList extends StatefulWidget { const PostsList({super.key}); @override State<PostsList> createState() => _PostsListState(); } class _PostsListState extends State<PostsList> { final _scrollController = ScrollController(); @override void initState() { super.initState(); _scrollController.addListener(_onScroll); } @override Widget build(BuildContext context) { return BlocBuilder<PostBloc, PostState>( builder: (context, state) { switch (state.status) { case PostStatus.failure: return const Center(child: Text('failed to fetch posts')); case PostStatus.success: if (state.posts.isEmpty) { return const Center(child: Text('no posts')); } return ListView.builder( itemBuilder: (BuildContext context, int index) { return index >= state.posts.length ? const BottomLoader() : PostListItem(post: state.posts[index]); }, itemCount: state.hasReachedMax ? state.posts.length : state.posts.length + 1, controller: _scrollController, ); case PostStatus.initial: return const Center(child: CircularProgressIndicator()); } }, ); } @override void dispose() { _scrollController ..removeListener(_onScroll) ..dispose(); super.dispose(); } void _onScroll() { if (_isBottom) context.read<PostBloc>().add(PostFetched()); } bool get _isBottom { if (!_scrollController.hasClients) return false; final maxScroll = _scrollController.position.maxScrollExtent; final currentScroll = _scrollController.offset; return currentScroll >= (maxScroll * 0.9); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/view/posts_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_infinite_list/posts/posts.dart'; import 'package:http/http.dart' as http; class PostsPage extends StatelessWidget { const PostsPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Posts')), body: BlocProvider( create: (_) => PostBloc(httpClient: http.Client())..add(PostFetched()), child: const PostsList(), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/view/view.dart ================================================ export 'posts_list.dart'; export 'posts_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/widgets/bottom_loader.dart ================================================ import 'package:flutter/material.dart'; class BottomLoader extends StatelessWidget { const BottomLoader({super.key}); @override Widget build(BuildContext context) { return const Center( child: SizedBox( height: 24, width: 24, child: CircularProgressIndicator(strokeWidth: 1.5), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/widgets/post_list_item.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_infinite_list/posts/posts.dart'; class PostListItem extends StatelessWidget { const PostListItem({required this.post, super.key}); final Post post; @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; return Material( child: ListTile( leading: Text('${post.id}', style: textTheme.bodySmall), title: Text(post.title), isThreeLine: true, subtitle: Text(post.body), dense: true, ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/posts/widgets/widgets.dart ================================================ export 'bottom_loader.dart'; export 'post_list_item.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_infinite_list/simple_bloc_observer.dart ================================================ // ignore_for_file: avoid_print import 'package:bloc/bloc.dart'; class SimpleBlocObserver extends BlocObserver { const SimpleBlocObserver(); @override void onTransition( Bloc<dynamic, dynamic> bloc, Transition<dynamic, dynamic> transition, ) { super.onTransition(bloc, transition); print(transition); } @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { print(error); super.onError(bloc, error, stackTrace); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/app.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_login/authentication/authentication.dart'; import 'package:flutter_login/home/home.dart'; import 'package:flutter_login/login/login.dart'; import 'package:flutter_login/splash/splash.dart'; import 'package:user_repository/user_repository.dart'; class App extends StatefulWidget { const App({super.key}); @override State<App> createState() => _AppState(); } class _AppState extends State<App> { late final AuthenticationRepository _authenticationRepository; late final UserRepository _userRepository; @override void initState() { super.initState(); _authenticationRepository = AuthenticationRepository(); _userRepository = UserRepository(); } @override void dispose() { _authenticationRepository.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return RepositoryProvider.value( value: _authenticationRepository, child: BlocProvider( create: (_) => AuthenticationBloc( authenticationRepository: _authenticationRepository, userRepository: _userRepository, ), child: const AppView(), ), ); } } class AppView extends StatefulWidget { const AppView({super.key}); @override State<AppView> createState() => _AppViewState(); } class _AppViewState extends State<AppView> { final _navigatorKey = GlobalKey<NavigatorState>(); NavigatorState get _navigator => _navigatorKey.currentState!; @override Widget build(BuildContext context) { return MaterialApp( navigatorKey: _navigatorKey, builder: (context, child) { return BlocListener<AuthenticationBloc, AuthenticationState>( listener: (context, state) { switch (state.status) { case AuthenticationStatus.authenticated: _navigator.pushAndRemoveUntil<void>( HomePage.route(), (route) => false, ); case AuthenticationStatus.unauthenticated: _navigator.pushAndRemoveUntil<void>( LoginPage.route(), (route) => false, ); case AuthenticationStatus.unknown: break; } }, child: child, ); }, onGenerateRoute: (_) => SplashPage.route(), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/authentication/authentication.dart ================================================ export 'bloc/authentication_bloc.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/authentication/bloc/authentication_bloc.dart ================================================ import 'dart:async'; import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:user_repository/user_repository.dart'; part 'authentication_event.dart'; part 'authentication_state.dart'; class AuthenticationBloc extends Bloc<AuthenticationEvent, AuthenticationState> { AuthenticationBloc({ required AuthenticationRepository authenticationRepository, required UserRepository userRepository, }) : _authenticationRepository = authenticationRepository, _userRepository = userRepository, super(const AuthenticationState.unknown()) { on<_AuthenticationStatusChanged>(_onAuthenticationStatusChanged); on<AuthenticationLogoutRequested>(_onAuthenticationLogoutRequested); _authenticationStatusSubscription = _authenticationRepository.status.listen( (status) => add(_AuthenticationStatusChanged(status)), ); } final AuthenticationRepository _authenticationRepository; final UserRepository _userRepository; late StreamSubscription<AuthenticationStatus> _authenticationStatusSubscription; @override Future<void> close() { _authenticationStatusSubscription.cancel(); return super.close(); } Future<void> _onAuthenticationStatusChanged( _AuthenticationStatusChanged event, Emitter<AuthenticationState> emit, ) async { switch (event.status) { case AuthenticationStatus.unauthenticated: return emit(const AuthenticationState.unauthenticated()); case AuthenticationStatus.authenticated: final user = await _tryGetUser(); return emit( user != null ? AuthenticationState.authenticated(user) : const AuthenticationState.unauthenticated(), ); case AuthenticationStatus.unknown: return emit(const AuthenticationState.unknown()); } } void _onAuthenticationLogoutRequested( AuthenticationLogoutRequested event, Emitter<AuthenticationState> emit, ) { _authenticationRepository.logOut(); } Future<User?> _tryGetUser() async { try { final user = await _userRepository.getUser(); return user; } catch (_) { return null; } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/authentication/bloc/authentication_event.dart ================================================ part of 'authentication_bloc.dart'; sealed class AuthenticationEvent { const AuthenticationEvent(); } final class _AuthenticationStatusChanged extends AuthenticationEvent { const _AuthenticationStatusChanged(this.status); final AuthenticationStatus status; } final class AuthenticationLogoutRequested extends AuthenticationEvent {} ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/authentication/bloc/authentication_state.dart ================================================ part of 'authentication_bloc.dart'; class AuthenticationState extends Equatable { const AuthenticationState._({ this.status = AuthenticationStatus.unknown, this.user = User.empty, }); const AuthenticationState.unknown() : this._(); const AuthenticationState.authenticated(User user) : this._(status: AuthenticationStatus.authenticated, user: user); const AuthenticationState.unauthenticated() : this._(status: AuthenticationStatus.unauthenticated); final AuthenticationStatus status; final User user; @override List<Object> get props => [status, user]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/home/home.dart ================================================ export 'view/home_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/home/view/home_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_login/authentication/authentication.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); static Route<void> route() { return MaterialPageRoute<void>(builder: (_) => const HomePage()); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Home')), body: Center( child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ Builder( builder: (context) { final userId = context.select( (AuthenticationBloc bloc) => bloc.state.user.id, ); return Text('UserID: $userId'); }, ), ElevatedButton( child: const Text('Logout'), onPressed: () { context .read<AuthenticationBloc>() .add(AuthenticationLogoutRequested()); }, ), ], ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/bloc/login_bloc.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_login/login/login.dart'; import 'package:formz/formz.dart'; part 'login_event.dart'; part 'login_state.dart'; class LoginBloc extends Bloc<LoginEvent, LoginState> { LoginBloc({ required AuthenticationRepository authenticationRepository, }) : _authenticationRepository = authenticationRepository, super(const LoginState()) { on<LoginUsernameChanged>(_onUsernameChanged); on<LoginPasswordChanged>(_onPasswordChanged); on<LoginSubmitted>(_onSubmitted); } final AuthenticationRepository _authenticationRepository; void _onUsernameChanged( LoginUsernameChanged event, Emitter<LoginState> emit, ) { final username = Username.dirty(event.username); emit( state.copyWith( username: username, isValid: Formz.validate([state.password, username]), ), ); } void _onPasswordChanged( LoginPasswordChanged event, Emitter<LoginState> emit, ) { final password = Password.dirty(event.password); emit( state.copyWith( password: password, isValid: Formz.validate([password, state.username]), ), ); } Future<void> _onSubmitted( LoginSubmitted event, Emitter<LoginState> emit, ) async { if (state.isValid) { emit(state.copyWith(status: FormzSubmissionStatus.inProgress)); try { await _authenticationRepository.logIn( username: state.username.value, password: state.password.value, ); emit(state.copyWith(status: FormzSubmissionStatus.success)); } catch (_) { emit(state.copyWith(status: FormzSubmissionStatus.failure)); } } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/bloc/login_event.dart ================================================ part of 'login_bloc.dart'; sealed class LoginEvent extends Equatable { const LoginEvent(); @override List<Object> get props => []; } final class LoginUsernameChanged extends LoginEvent { const LoginUsernameChanged(this.username); final String username; @override List<Object> get props => [username]; } final class LoginPasswordChanged extends LoginEvent { const LoginPasswordChanged(this.password); final String password; @override List<Object> get props => [password]; } final class LoginSubmitted extends LoginEvent { const LoginSubmitted(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/bloc/login_state.dart ================================================ part of 'login_bloc.dart'; final class LoginState extends Equatable { const LoginState({ this.status = FormzSubmissionStatus.initial, this.username = const Username.pure(), this.password = const Password.pure(), this.isValid = false, }); final FormzSubmissionStatus status; final Username username; final Password password; final bool isValid; LoginState copyWith({ FormzSubmissionStatus? status, Username? username, Password? password, bool? isValid, }) { return LoginState( status: status ?? this.status, username: username ?? this.username, password: password ?? this.password, isValid: isValid ?? this.isValid, ); } @override List<Object> get props => [status, username, password]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/login.dart ================================================ export 'bloc/login_bloc.dart'; export 'models/models.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/models/models.dart ================================================ export 'password.dart'; export 'username.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/models/password.dart ================================================ import 'package:formz/formz.dart'; enum PasswordValidationError { empty } class Password extends FormzInput<String, PasswordValidationError> { const Password.pure() : super.pure(''); const Password.dirty([super.value = '']) : super.dirty(); @override PasswordValidationError? validator(String value) { if (value.isEmpty) return PasswordValidationError.empty; return null; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/models/username.dart ================================================ import 'package:formz/formz.dart'; enum UsernameValidationError { empty } class Username extends FormzInput<String, UsernameValidationError> { const Username.pure() : super.pure(''); const Username.dirty([super.value = '']) : super.dirty(); @override UsernameValidationError? validator(String value) { if (value.isEmpty) return UsernameValidationError.empty; return null; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/view/login_form.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_login/login/login.dart'; import 'package:formz/formz.dart'; class LoginForm extends StatelessWidget { const LoginForm({super.key}); @override Widget build(BuildContext context) { return BlocListener<LoginBloc, LoginState>( listener: (context, state) { if (state.status.isFailure) { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( const SnackBar(content: Text('Authentication Failure')), ); } }, child: Align( alignment: const Alignment(0, -1 / 3), child: Column( mainAxisSize: MainAxisSize.min, children: [ _UsernameInput(), const Padding(padding: EdgeInsets.all(12)), _PasswordInput(), const Padding(padding: EdgeInsets.all(12)), _LoginButton(), ], ), ), ); } } class _UsernameInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginBloc, LoginState>( buildWhen: (previous, current) => previous.username != current.username, builder: (context, state) { return TextField( key: const Key('loginForm_usernameInput_textField'), onChanged: (username) => context.read<LoginBloc>().add(LoginUsernameChanged(username)), decoration: InputDecoration( labelText: 'username', errorText: state.username.displayError != null ? 'invalid username' : null, ), ); }, ); } } class _PasswordInput extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginBloc, LoginState>( buildWhen: (previous, current) => previous.password != current.password, builder: (context, state) { return TextField( key: const Key('loginForm_passwordInput_textField'), onChanged: (password) => context.read<LoginBloc>().add(LoginPasswordChanged(password)), obscureText: true, decoration: InputDecoration( labelText: 'password', errorText: state.password.displayError != null ? 'invalid password' : null, ), ); }, ); } } class _LoginButton extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder<LoginBloc, LoginState>( builder: (context, state) { return state.status.isInProgress ? const CircularProgressIndicator() : ElevatedButton( key: const Key('loginForm_continue_raisedButton'), onPressed: state.isValid ? () { context.read<LoginBloc>().add(const LoginSubmitted()); } : null, child: const Text('Login'), ); }, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/view/login_page.dart ================================================ import 'package:authentication_repository/authentication_repository.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_login/login/login.dart'; class LoginPage extends StatelessWidget { const LoginPage({super.key}); static Route<void> route() { return MaterialPageRoute<void>(builder: (_) => const LoginPage()); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Login')), body: Padding( padding: const EdgeInsets.all(12), child: BlocProvider( create: (context) { return LoginBloc( authenticationRepository: RepositoryProvider.of<AuthenticationRepository>(context), ); }, child: const LoginForm(), ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/login/view/view.dart ================================================ export 'login_form.dart'; export 'login_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/main.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_login/app.dart'; void main() => runApp(const App()); ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/splash/splash.dart ================================================ export 'view/splash_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_login/splash/view/splash_page.dart ================================================ import 'package:flutter/material.dart'; class SplashPage extends StatelessWidget { const SplashPage({super.key}); static Route<void> route() { return MaterialPageRoute<void>(builder: (_) => const SplashPage()); } @override Widget build(BuildContext context) { return const Scaffold( body: Center(child: CircularProgressIndicator()), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .packages .pub-cache/ .pub/ /build/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_shopping_cart/cart/cart.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; import 'package:flutter_shopping_cart/shopping_repository.dart'; class App extends StatelessWidget { const App({required this.shoppingRepository, super.key}); final ShoppingRepository shoppingRepository; @override Widget build(BuildContext context) { return MultiBlocProvider( providers: [ BlocProvider( create: (_) => CatalogBloc( shoppingRepository: shoppingRepository, )..add(CatalogStarted()), ), BlocProvider( create: (_) => CartBloc( shoppingRepository: shoppingRepository, )..add(CartStarted()), ), ], child: MaterialApp( title: 'Flutter Bloc Shopping Cart', initialRoute: '/', routes: { '/': (_) => const CatalogPage(), '/cart': (_) => const CartPage(), }, ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/bloc/cart_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_shopping_cart/cart/cart.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; import 'package:flutter_shopping_cart/shopping_repository.dart'; import 'package:meta/meta.dart'; part 'cart_event.dart'; part 'cart_state.dart'; class CartBloc extends Bloc<CartEvent, CartState> { CartBloc({required this.shoppingRepository}) : super(CartLoading()) { on<CartStarted>(_onStarted); on<CartItemAdded>(_onItemAdded); on<CartItemRemoved>(_onItemRemoved); } final ShoppingRepository shoppingRepository; Future<void> _onStarted(CartStarted event, Emitter<CartState> emit) async { emit(CartLoading()); try { final items = await shoppingRepository.loadCartItems(); emit(CartLoaded(cart: Cart(items: [...items]))); } catch (_) { emit(CartError()); } } Future<void> _onItemAdded( CartItemAdded event, Emitter<CartState> emit, ) async { final state = this.state; if (state is CartLoaded) { try { shoppingRepository.addItemToCart(event.item); emit(CartLoaded(cart: Cart(items: [...state.cart.items, event.item]))); } catch (_) { emit(CartError()); } } } void _onItemRemoved(CartItemRemoved event, Emitter<CartState> emit) { final state = this.state; if (state is CartLoaded) { try { shoppingRepository.removeItemFromCart(event.item); emit( CartLoaded( cart: Cart( items: [...state.cart.items]..remove(event.item), ), ), ); } catch (_) { emit(CartError()); } } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/bloc/cart_event.dart ================================================ part of 'cart_bloc.dart'; @immutable sealed class CartEvent extends Equatable { const CartEvent(); } final class CartStarted extends CartEvent { @override List<Object> get props => []; } final class CartItemAdded extends CartEvent { const CartItemAdded(this.item); final Item item; @override List<Object> get props => [item]; } final class CartItemRemoved extends CartEvent { const CartItemRemoved(this.item); final Item item; @override List<Object> get props => [item]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/bloc/cart_state.dart ================================================ part of 'cart_bloc.dart'; @immutable sealed class CartState extends Equatable { const CartState(); } final class CartLoading extends CartState { @override List<Object> get props => []; } final class CartLoaded extends CartState { const CartLoaded({this.cart = const Cart()}); final Cart cart; @override List<Object> get props => [cart]; } final class CartError extends CartState { @override List<Object> get props => []; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/cart.dart ================================================ export 'bloc/cart_bloc.dart'; export 'models/models.dart'; export 'view/cart_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/models/cart.dart ================================================ import 'package:equatable/equatable.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; class Cart extends Equatable { const Cart({this.items = const <Item>[]}); final List<Item> items; int get totalPrice { return items.fold(0, (total, current) => total + current.price); } @override List<Object> get props => [items]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/models/models.dart ================================================ export 'cart.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/cart/view/cart_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_shopping_cart/cart/cart.dart'; class CartPage extends StatelessWidget { const CartPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Cart')), body: const ColoredBox( color: Colors.yellow, child: Column( children: [ Expanded( child: Padding( padding: EdgeInsets.all(32), child: CartList(), ), ), Divider(height: 4, color: Colors.black), CartTotal(), ], ), ), ); } } class CartList extends StatelessWidget { const CartList({super.key}); @override Widget build(BuildContext context) { final itemNameStyle = Theme.of(context).textTheme.titleLarge; return BlocBuilder<CartBloc, CartState>( builder: (context, state) { return switch (state) { CartLoading() => const CircularProgressIndicator(), CartError() => const Text('Something went wrong!'), CartLoaded() => ListView.separated( itemCount: state.cart.items.length, separatorBuilder: (_, __) => const SizedBox(height: 4), itemBuilder: (context, index) { final item = state.cart.items[index]; return Material( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), ), clipBehavior: Clip.hardEdge, child: ListTile( leading: const Icon(Icons.done), title: Text(item.name, style: itemNameStyle), onLongPress: () { context.read<CartBloc>().add(CartItemRemoved(item)); }, ), ); }, ), }; }, ); } } class CartTotal extends StatelessWidget { const CartTotal({super.key}); @override Widget build(BuildContext context) { final hugeStyle = Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 48); return SizedBox( height: 200, child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ BlocBuilder<CartBloc, CartState>( builder: (context, state) { return switch (state) { CartLoading() => const CircularProgressIndicator(), CartError() => const Text('Something went wrong!'), CartLoaded() => Text('\$${state.cart.totalPrice}', style: hugeStyle), }; }, ), const SizedBox(width: 24), ElevatedButton( onPressed: () { ScaffoldMessenger.of(context).showSnackBar( const SnackBar(content: Text('Buying not supported yet.')), ); }, style: ElevatedButton.styleFrom(backgroundColor: Colors.black), child: const Text('BUY'), ), ], ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/bloc/catalog_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; import 'package:flutter_shopping_cart/shopping_repository.dart'; part 'catalog_event.dart'; part 'catalog_state.dart'; class CatalogBloc extends Bloc<CatalogEvent, CatalogState> { CatalogBloc({required this.shoppingRepository}) : super(CatalogLoading()) { on<CatalogStarted>(_onStarted); } final ShoppingRepository shoppingRepository; Future<void> _onStarted( CatalogStarted event, Emitter<CatalogState> emit, ) async { emit(CatalogLoading()); try { final catalog = await shoppingRepository.loadCatalog(); emit(CatalogLoaded(Catalog(itemNames: catalog))); } catch (_) { emit(CatalogError()); } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/bloc/catalog_event.dart ================================================ part of 'catalog_bloc.dart'; sealed class CatalogEvent extends Equatable { const CatalogEvent(); } final class CatalogStarted extends CatalogEvent { @override List<Object> get props => []; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/bloc/catalog_state.dart ================================================ part of 'catalog_bloc.dart'; sealed class CatalogState extends Equatable { const CatalogState(); @override List<Object> get props => []; } final class CatalogLoading extends CatalogState {} final class CatalogLoaded extends CatalogState { const CatalogLoaded(this.catalog); final Catalog catalog; @override List<Object> get props => [catalog]; } final class CatalogError extends CatalogState {} ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/catalog.dart ================================================ export 'bloc/catalog_bloc.dart'; export 'models/models.dart'; export 'view/catalog_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/models/catalog.dart ================================================ import 'package:equatable/equatable.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; class Catalog extends Equatable { const Catalog({required this.itemNames}); final List<String> itemNames; Item getById(int id) => Item(id, itemNames[id % itemNames.length]); Item getByPosition(int position) => getById(position); @override List<Object> get props => [itemNames]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/models/item.dart ================================================ import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; class Item extends Equatable { Item(this.id, this.name) : color = Colors.primaries[id % Colors.primaries.length]; final int id; final String name; final Color color; final int price = 42; @override List<Object> get props => [id, name, color, price]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/models/models.dart ================================================ export 'catalog.dart'; export 'item.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/catalog/view/catalog_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_shopping_cart/cart/cart.dart'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; class CatalogPage extends StatelessWidget { const CatalogPage({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( slivers: [ const CatalogAppBar(), const SliverToBoxAdapter(child: SizedBox(height: 12)), BlocBuilder<CatalogBloc, CatalogState>( builder: (context, state) { return switch (state) { CatalogLoading() => const SliverFillRemaining( child: Center(child: CircularProgressIndicator()), ), CatalogError() => const SliverFillRemaining( child: Text('Something went wrong!'), ), CatalogLoaded() => SliverList( delegate: SliverChildBuilderDelegate( (context, index) => CatalogListItem( state.catalog.getByPosition(index), ), childCount: state.catalog.itemNames.length, ), ) }; }, ), ], ), ); } } class AddButton extends StatelessWidget { const AddButton({required this.item, super.key}); final Item item; @override Widget build(BuildContext context) { final theme = Theme.of(context); return BlocBuilder<CartBloc, CartState>( builder: (context, state) { return switch (state) { CartLoading() => const CircularProgressIndicator(), CartError() => const Text('Something went wrong!'), CartLoaded() => Builder( builder: (context) { final isInCart = state.cart.items.contains(item); return TextButton( style: TextButton.styleFrom( disabledForegroundColor: theme.primaryColor, ), onPressed: isInCart ? null : () => context.read<CartBloc>().add(CartItemAdded(item)), child: isInCart ? const Icon(Icons.check, semanticLabel: 'ADDED') : const Text('ADD'), ); }, ) }; }, ); } } class CatalogAppBar extends StatelessWidget { const CatalogAppBar({super.key}); @override Widget build(BuildContext context) { return SliverAppBar( title: const Text('Catalog'), floating: true, actions: [ IconButton( icon: const Icon(Icons.shopping_cart), onPressed: () => Navigator.of(context).pushNamed('/cart'), ), ], ); } } class CatalogListItem extends StatelessWidget { const CatalogListItem(this.item, {super.key}); final Item item; @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme.titleLarge; return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), child: LimitedBox( maxHeight: 48, child: Row( children: [ AspectRatio(aspectRatio: 1, child: ColoredBox(color: item.color)), const SizedBox(width: 24), Expanded(child: Text(item.name, style: textTheme)), const SizedBox(width: 24), AddButton(item: item), ], ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/main.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_shopping_cart/app.dart'; import 'package:flutter_shopping_cart/shopping_repository.dart'; import 'package:flutter_shopping_cart/simple_bloc_observer.dart'; void main() { Bloc.observer = const SimpleBlocObserver(); runApp(App(shoppingRepository: ShoppingRepository())); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/shopping_repository.dart ================================================ import 'dart:async'; import 'package:flutter_shopping_cart/catalog/catalog.dart'; const _delay = Duration(milliseconds: 800); const _catalog = [ 'Code Smell', 'Control Flow', 'Interpreter', 'Recursion', 'Sprint', 'Heisenbug', 'Spaghetti', 'Hydra Code', 'Off-By-One', 'Scope', 'Callback', 'Closure', 'Automata', 'Bit Shift', 'Currying', ]; class ShoppingRepository { final _items = <Item>[]; Future<List<String>> loadCatalog() => Future.delayed(_delay, () => _catalog); Future<List<Item>> loadCartItems() => Future.delayed(_delay, () => _items); void addItemToCart(Item item) => _items.add(item); void removeItemFromCart(Item item) => _items.remove(item); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_shopping_cart/simple_bloc_observer.dart ================================================ import 'dart:developer'; import 'package:bloc/bloc.dart'; class SimpleBlocObserver extends BlocObserver { const SimpleBlocObserver(); @override void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) { super.onEvent(bloc, event); log('${bloc.runtimeType} $event'); } @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { log('${bloc.runtimeType} $error'); super.onError(bloc, error, stackTrace); } @override void onTransition( Bloc<dynamic, dynamic> bloc, Transition<dynamic, dynamic> transition, ) { super.onTransition(bloc, transition); log('$transition'); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile /android/app/release ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_timer/timer/timer.dart'; class App extends StatelessWidget { const App({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Timer', theme: ThemeData( primaryColor: const Color.fromRGBO(109, 234, 255, 1), colorScheme: const ColorScheme.light( secondary: Color.fromRGBO(72, 74, 126, 1), ), ), home: const TimerPage(), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/main.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_timer/app.dart'; void main() => runApp(const App()); ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/ticker.dart ================================================ class Ticker { const Ticker(); Stream<int> tick({required int ticks}) { return Stream.periodic(const Duration(seconds: 1), (x) => ticks - x - 1) .take(ticks); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/timer/bloc/timer_bloc.dart ================================================ import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_timer/ticker.dart'; part 'timer_event.dart'; part 'timer_state.dart'; class TimerBloc extends Bloc<TimerEvent, TimerState> { TimerBloc({required Ticker ticker}) : _ticker = ticker, super(const TimerInitial(_duration)) { on<TimerStarted>(_onStarted); on<TimerPaused>(_onPaused); on<TimerResumed>(_onResumed); on<TimerReset>(_onReset); on<_TimerTicked>(_onTicked); } final Ticker _ticker; static const int _duration = 60; StreamSubscription<int>? _tickerSubscription; @override Future<void> close() { _tickerSubscription?.cancel(); return super.close(); } void _onStarted(TimerStarted event, Emitter<TimerState> emit) { emit(TimerRunInProgress(event.duration)); _tickerSubscription?.cancel(); _tickerSubscription = _ticker .tick(ticks: event.duration) .listen((duration) => add(_TimerTicked(duration: duration))); } void _onPaused(TimerPaused event, Emitter<TimerState> emit) { if (state is TimerRunInProgress) { _tickerSubscription?.pause(); emit(TimerRunPause(state.duration)); } } void _onResumed(TimerResumed resume, Emitter<TimerState> emit) { if (state is TimerRunPause) { _tickerSubscription?.resume(); emit(TimerRunInProgress(state.duration)); } } void _onReset(TimerReset event, Emitter<TimerState> emit) { _tickerSubscription?.cancel(); emit(const TimerInitial(_duration)); } void _onTicked(_TimerTicked event, Emitter<TimerState> emit) { emit( event.duration > 0 ? TimerRunInProgress(event.duration) : const TimerRunComplete(), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/timer/bloc/timer_event.dart ================================================ part of 'timer_bloc.dart'; sealed class TimerEvent { const TimerEvent(); } final class TimerStarted extends TimerEvent { const TimerStarted({required this.duration}); final int duration; } final class TimerPaused extends TimerEvent { const TimerPaused(); } final class TimerResumed extends TimerEvent { const TimerResumed(); } class TimerReset extends TimerEvent { const TimerReset(); } class _TimerTicked extends TimerEvent { const _TimerTicked({required this.duration}); final int duration; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/timer/bloc/timer_state.dart ================================================ part of 'timer_bloc.dart'; sealed class TimerState extends Equatable { const TimerState(this.duration); final int duration; @override List<Object> get props => [duration]; } final class TimerInitial extends TimerState { const TimerInitial(super.duration); @override String toString() => 'TimerInitial { duration: $duration }'; } final class TimerRunPause extends TimerState { const TimerRunPause(super.duration); @override String toString() => 'TimerRunPause { duration: $duration }'; } final class TimerRunInProgress extends TimerState { const TimerRunInProgress(super.duration); @override String toString() => 'TimerRunInProgress { duration: $duration }'; } final class TimerRunComplete extends TimerState { const TimerRunComplete() : super(0); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/timer/timer.dart ================================================ export 'bloc/timer_bloc.dart'; export 'view/timer_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_timer/timer/view/timer_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_timer/ticker.dart'; import 'package:flutter_timer/timer/timer.dart'; class TimerPage extends StatelessWidget { const TimerPage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (_) => TimerBloc(ticker: const Ticker()), child: const TimerView(), ); } } class TimerView extends StatelessWidget { const TimerView({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Flutter Timer')), body: const Stack( children: [ Background(), Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Padding( padding: EdgeInsets.symmetric(vertical: 100), child: Center(child: TimerText()), ), Actions(), ], ), ], ), ); } } class TimerText extends StatelessWidget { const TimerText({super.key}); @override Widget build(BuildContext context) { final duration = context.select((TimerBloc bloc) => bloc.state.duration); final minutesStr = ((duration / 60) % 60).floor().toString().padLeft(2, '0'); final secondsStr = (duration % 60).toString().padLeft(2, '0'); return Text( '$minutesStr:$secondsStr', style: Theme.of(context).textTheme.displayLarge, ); } } class Actions extends StatelessWidget { const Actions({super.key}); @override Widget build(BuildContext context) { return BlocBuilder<TimerBloc, TimerState>( buildWhen: (prev, state) => prev.runtimeType != state.runtimeType, builder: (context, state) { return Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ...switch (state) { TimerInitial() => [ FloatingActionButton( child: const Icon(Icons.play_arrow), onPressed: () => context .read<TimerBloc>() .add(TimerStarted(duration: state.duration)), ), ], TimerRunInProgress() => [ FloatingActionButton( child: const Icon(Icons.pause), onPressed: () => context.read<TimerBloc>().add(const TimerPaused()), ), FloatingActionButton( child: const Icon(Icons.replay), onPressed: () => context.read<TimerBloc>().add(const TimerReset()), ), ], TimerRunPause() => [ FloatingActionButton( child: const Icon(Icons.play_arrow), onPressed: () => context.read<TimerBloc>().add(const TimerResumed()), ), FloatingActionButton( child: const Icon(Icons.replay), onPressed: () => context.read<TimerBloc>().add(const TimerReset()), ), ], TimerRunComplete() => [ FloatingActionButton( child: const Icon(Icons.replay), onPressed: () => context.read<TimerBloc>().add(const TimerReset()), ), ] }, ], ); }, ); } } class Background extends StatelessWidget { const Background({super.key}); @override Widget build(BuildContext context) { return SizedBox.expand( child: DecoratedBox( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Colors.blue.shade50, Colors.blue.shade500, ], ), ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/.gitignore ================================================ # Miscellaneous *.class *.lock *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/* # Visual Studio Code related .classpath .project .settings/ .vscode/* # Flutter repo-specific /bin/cache/ /bin/mingit/ /dev/benchmarks/mega_gallery/ /dev/bots/.recipe_deps /dev/bots/android_tools/ /dev/docs/doc/ /dev/docs/flutter.docs.zip /dev/docs/lib/ /dev/docs/pubspec.yaml /dev/integration_tests/**/xcuserdata /dev/integration_tests/**/Pods /packages/flutter/coverage/ version # packages file containing multi-root paths .packages.generated # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ build/ flutter_*.png linked_*.ds unlinked.ds unlinked_spec.ds .fvm/ # Android related **/android/**/gradle-wrapper.jar **/android/.gradle **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java **/android/key.properties **/android/.idea/ *.jks # iOS/XCode related **/ios/**/*.mode1v3 **/ios/**/*.mode2v3 **/ios/**/*.moved-aside **/ios/**/*.pbxuser **/ios/**/*.perspectivev3 **/ios/**/*sync/ **/ios/**/.sconsign.dblite **/ios/**/.tags* **/ios/**/.vagrant/ **/ios/**/DerivedData/ **/ios/**/Icon? **/ios/**/Pods/ **/ios/**/.symlinks/ **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework **/ios/Flutter/Flutter.podspec **/ios/Flutter/Generated.xcconfig **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/.last_build_id **/ios/Flutter/flutter_assets/ **/ios/Flutter/flutter_export_environment.sh **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* # Coverage coverage/ # Submodules !pubspec.lock packages/**/pubspec.lock # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Exceptions to the above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages !/dev/ci/**/Gemfile.lock !.vscode/extensions.json !.vscode/launch.json !.idea/codeStyles/ !.idea/dictionaries/ !.idea/runConfigurations/ ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/.vscode/launch.json ================================================ { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Launch development", "request": "launch", "type": "dart", "program": "lib/main_development.dart", "args": [ "--flavor", "development", "--target", "lib/main_development.dart" ] }, { "name": "Launch staging", "request": "launch", "type": "dart", "program": "lib/main_staging.dart", "args": ["--flavor", "staging", "--target", "lib/main_staging.dart"] }, { "name": "Launch production", "request": "launch", "type": "dart", "program": "lib/main_production.dart", "args": ["--flavor", "production", "--target", "lib/main_production.dart"] } ] } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/app/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/home/home.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:flutter_todos/theme/theme.dart'; import 'package:todos_repository/todos_repository.dart'; class App extends StatelessWidget { const App({required this.todosRepository, super.key}); final TodosRepository todosRepository; @override Widget build(BuildContext context) { return RepositoryProvider.value( value: todosRepository, child: const AppView(), ); } } class AppView extends StatelessWidget { const AppView({super.key}); @override Widget build(BuildContext context) { return MaterialApp( theme: FlutterTodosTheme.light, darkTheme: FlutterTodosTheme.dark, localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: const HomePage(), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/app/app_bloc_observer.dart ================================================ import 'dart:developer'; import 'package:bloc/bloc.dart'; class AppBlocObserver extends BlocObserver { const AppBlocObserver(); @override void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { super.onChange(bloc, change); log('onChange(${bloc.runtimeType}, $change)'); } @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { log('onError(${bloc.runtimeType}, $error, $stackTrace)'); super.onError(bloc, error, stackTrace); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/bootstrap.dart ================================================ import 'dart:async'; import 'dart:developer'; import 'package:bloc/bloc.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_todos/app/app.dart'; import 'package:flutter_todos/app/app_bloc_observer.dart'; import 'package:todos_api/todos_api.dart'; import 'package:todos_repository/todos_repository.dart'; void bootstrap({required TodosApi todosApi}) { FlutterError.onError = (details) { log(details.exceptionAsString(), stackTrace: details.stack); }; Bloc.observer = const AppBlocObserver(); final todosRepository = TodosRepository(todosApi: todosApi); runZonedGuarded( () => runApp(App(todosRepository: todosRepository)), (error, stackTrace) => log(error.toString(), stackTrace: stackTrace), ); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/bloc/edit_todo_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:todos_repository/todos_repository.dart'; part 'edit_todo_event.dart'; part 'edit_todo_state.dart'; class EditTodoBloc extends Bloc<EditTodoEvent, EditTodoState> { EditTodoBloc({ required TodosRepository todosRepository, required Todo? initialTodo, }) : _todosRepository = todosRepository, super( EditTodoState( initialTodo: initialTodo, title: initialTodo?.title ?? '', description: initialTodo?.description ?? '', ), ) { on<EditTodoTitleChanged>(_onTitleChanged); on<EditTodoDescriptionChanged>(_onDescriptionChanged); on<EditTodoSubmitted>(_onSubmitted); } final TodosRepository _todosRepository; void _onTitleChanged( EditTodoTitleChanged event, Emitter<EditTodoState> emit, ) { emit(state.copyWith(title: event.title)); } void _onDescriptionChanged( EditTodoDescriptionChanged event, Emitter<EditTodoState> emit, ) { emit(state.copyWith(description: event.description)); } Future<void> _onSubmitted( EditTodoSubmitted event, Emitter<EditTodoState> emit, ) async { emit(state.copyWith(status: EditTodoStatus.loading)); final todo = (state.initialTodo ?? Todo(title: '')).copyWith( title: state.title, description: state.description, ); try { await _todosRepository.saveTodo(todo); emit(state.copyWith(status: EditTodoStatus.success)); } catch (e) { emit(state.copyWith(status: EditTodoStatus.failure)); } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/bloc/edit_todo_event.dart ================================================ part of 'edit_todo_bloc.dart'; sealed class EditTodoEvent extends Equatable { const EditTodoEvent(); @override List<Object> get props => []; } final class EditTodoTitleChanged extends EditTodoEvent { const EditTodoTitleChanged(this.title); final String title; @override List<Object> get props => [title]; } final class EditTodoDescriptionChanged extends EditTodoEvent { const EditTodoDescriptionChanged(this.description); final String description; @override List<Object> get props => [description]; } final class EditTodoSubmitted extends EditTodoEvent { const EditTodoSubmitted(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/bloc/edit_todo_state.dart ================================================ part of 'edit_todo_bloc.dart'; enum EditTodoStatus { initial, loading, success, failure } extension EditTodoStatusX on EditTodoStatus { bool get isLoadingOrSuccess => [ EditTodoStatus.loading, EditTodoStatus.success, ].contains(this); } final class EditTodoState extends Equatable { const EditTodoState({ this.status = EditTodoStatus.initial, this.initialTodo, this.title = '', this.description = '', }); final EditTodoStatus status; final Todo? initialTodo; final String title; final String description; bool get isNewTodo => initialTodo == null; EditTodoState copyWith({ EditTodoStatus? status, Todo? initialTodo, String? title, String? description, }) { return EditTodoState( status: status ?? this.status, initialTodo: initialTodo ?? this.initialTodo, title: title ?? this.title, description: description ?? this.description, ); } @override List<Object?> get props => [status, initialTodo, title, description]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/edit_todo.dart ================================================ export 'bloc/edit_todo_bloc.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/view/edit_todo_page.dart ================================================ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/edit_todo/edit_todo.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:todos_repository/todos_repository.dart'; class EditTodoPage extends StatelessWidget { const EditTodoPage({super.key}); static Route<void> route({Todo? initialTodo}) { return MaterialPageRoute( fullscreenDialog: true, builder: (context) => BlocProvider( create: (context) => EditTodoBloc( todosRepository: context.read<TodosRepository>(), initialTodo: initialTodo, ), child: const EditTodoPage(), ), ); } @override Widget build(BuildContext context) { return BlocListener<EditTodoBloc, EditTodoState>( listenWhen: (previous, current) => previous.status != current.status && current.status == EditTodoStatus.success, listener: (context, state) => Navigator.of(context).pop(), child: const EditTodoView(), ); } } class EditTodoView extends StatelessWidget { const EditTodoView({super.key}); @override Widget build(BuildContext context) { final l10n = context.l10n; final status = context.select((EditTodoBloc bloc) => bloc.state.status); final isNewTodo = context.select( (EditTodoBloc bloc) => bloc.state.isNewTodo, ); final theme = Theme.of(context); final floatingActionButtonTheme = theme.floatingActionButtonTheme; final fabBackgroundColor = floatingActionButtonTheme.backgroundColor ?? theme.colorScheme.secondary; return Scaffold( appBar: AppBar( title: Text( isNewTodo ? l10n.editTodoAddAppBarTitle : l10n.editTodoEditAppBarTitle, ), ), floatingActionButton: FloatingActionButton( tooltip: l10n.editTodoSaveButtonTooltip, shape: const ContinuousRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(32)), ), backgroundColor: status.isLoadingOrSuccess ? fabBackgroundColor.withOpacity(0.5) : fabBackgroundColor, onPressed: status.isLoadingOrSuccess ? null : () => context.read<EditTodoBloc>().add(const EditTodoSubmitted()), child: status.isLoadingOrSuccess ? const CupertinoActivityIndicator() : const Icon(Icons.check_rounded), ), body: const CupertinoScrollbar( child: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(16), child: Column( children: [_TitleField(), _DescriptionField()], ), ), ), ), ); } } class _TitleField extends StatelessWidget { const _TitleField(); @override Widget build(BuildContext context) { final l10n = context.l10n; final state = context.watch<EditTodoBloc>().state; final hintText = state.initialTodo?.title ?? ''; return TextFormField( key: const Key('editTodoView_title_textFormField'), initialValue: state.title, decoration: InputDecoration( enabled: !state.status.isLoadingOrSuccess, labelText: l10n.editTodoTitleLabel, hintText: hintText, ), maxLength: 50, inputFormatters: [ LengthLimitingTextInputFormatter(50), FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9\s]')), ], onChanged: (value) { context.read<EditTodoBloc>().add(EditTodoTitleChanged(value)); }, ); } } class _DescriptionField extends StatelessWidget { const _DescriptionField(); @override Widget build(BuildContext context) { final l10n = context.l10n; final state = context.watch<EditTodoBloc>().state; final hintText = state.initialTodo?.description ?? ''; return TextFormField( key: const Key('editTodoView_description_textFormField'), initialValue: state.description, decoration: InputDecoration( enabled: !state.status.isLoadingOrSuccess, labelText: l10n.editTodoDescriptionLabel, hintText: hintText, ), maxLength: 300, maxLines: 7, inputFormatters: [ LengthLimitingTextInputFormatter(300), ], onChanged: (value) { context.read<EditTodoBloc>().add(EditTodoDescriptionChanged(value)); }, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/edit_todo/view/view.dart ================================================ export 'edit_todo_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/generated_plugin_registrant.dart ================================================ // // Generated file. Do not edit. // // ignore_for_file: directives_ordering // ignore_for_file: lines_longer_than_80_chars // ignore_for_file: depend_on_referenced_packages import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart'; // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { SharedPreferencesPlugin.registerWith(registrar); registrar.registerMessageHandler(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/home/cubit/home_cubit.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; part 'home_state.dart'; class HomeCubit extends Cubit<HomeState> { HomeCubit() : super(const HomeState()); void setTab(HomeTab tab) => emit(HomeState(tab: tab)); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/home/cubit/home_state.dart ================================================ part of 'home_cubit.dart'; enum HomeTab { todos, stats } final class HomeState extends Equatable { const HomeState({ this.tab = HomeTab.todos, }); final HomeTab tab; @override List<Object> get props => [tab]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/home/home.dart ================================================ export 'cubit/home_cubit.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/home/view/home_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/edit_todo/edit_todo.dart'; import 'package:flutter_todos/home/home.dart'; import 'package:flutter_todos/stats/stats.dart'; import 'package:flutter_todos/todos_overview/todos_overview.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (_) => HomeCubit(), child: const HomeView(), ); } } class HomeView extends StatelessWidget { const HomeView({super.key}); @override Widget build(BuildContext context) { final selectedTab = context.select((HomeCubit cubit) => cubit.state.tab); return Scaffold( body: IndexedStack( index: selectedTab.index, children: const [TodosOverviewPage(), StatsPage()], ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: FloatingActionButton( key: const Key('homeView_addTodo_floatingActionButton'), onPressed: () => Navigator.of(context).push(EditTodoPage.route()), child: const Icon(Icons.add), ), bottomNavigationBar: BottomAppBar( shape: const CircularNotchedRectangle(), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _HomeTabButton( groupValue: selectedTab, value: HomeTab.todos, icon: const Icon(Icons.list_rounded), ), _HomeTabButton( groupValue: selectedTab, value: HomeTab.stats, icon: const Icon(Icons.show_chart_rounded), ), ], ), ), ); } } class _HomeTabButton extends StatelessWidget { const _HomeTabButton({ required this.groupValue, required this.value, required this.icon, }); final HomeTab groupValue; final HomeTab value; final Widget icon; @override Widget build(BuildContext context) { return IconButton( onPressed: () => context.read<HomeCubit>().setTab(value), iconSize: 32, color: groupValue != value ? null : Theme.of(context).colorScheme.secondary, icon: icon, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/home/view/view.dart ================================================ export 'home_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/l10n/arb/app_en.arb ================================================ { "@@locale": "en", "todosOverviewAppBarTitle": "Flutter Todos", "@todosOverviewAppBarTitle": { "description": "Title text shown in the AppBar of the Todos Overview Page" }, "todosOverviewFilterTooltip": "Filter", "@todosOverviewFilterTooltip": { "description": "Tooltip text shown in the filter dropdown of the Todos Overview Page" }, "todosOverviewFilterAll": "All", "@todosOverviewFilterAll": { "description": "Text shown in the filter dropdown of the Todos Overview Page for the option to display all todos" }, "todosOverviewFilterActiveOnly": "Active only", "@todosOverviewFilterActiveOnly": { "description": "Text shown in the filter dropdown of the Todos Overview Page for the option to display active todos only" }, "todosOverviewFilterCompletedOnly": "Completed only", "@todosOverviewFilterCompletedOnly": { "description": "Text shown in the filter dropdown of the Todos Overview Page for the option to display completed todos only" }, "todosOverviewMarkAllCompleteButtonText": "Mark all complete", "@todosOverviewMarkAllCompleteButtonText": { "description": "Button text shown in the options dropdown of the Todos Overview Page that marks all current todos as complete" }, "todosOverviewClearCompletedButtonText": "Clear completed", "@todosOverviewClearCompletedButtonText": { "description": "Button text shown in the options dropdown of the Todos Overview Page that deletes all completed todos" }, "todosOverviewEmptyText": "No todos found with the selected filters.", "@todosOverviewEmptyText": { "description": "Text shown in the Todos Overview Page when no todos are found with the selected filters" }, "todosOverviewTodoDeletedSnackbarText": "Todo \"{todoTitle}\" deleted.", "@todosOverviewTodoDeletedSnackbarText": { "description": "Snackbar text shown when a todo is deleted from the Todos Overview Page", "placeholders": { "todoTitle": { "description": "The title of the todo that was deleted" } } }, "todosOverviewUndoDeletionButtonText": "Undo", "@todosOverviewUndoDeletionButtonText": { "description": "Button text shown in the snackbar that undoes a deletion of a todo" }, "todosOverviewErrorSnackbarText": "An error occurred while loading todos.", "@todosOverviewErrorSnackbarText": { "description": "Snackbar text shown when an error occurs while loading todos" }, "todosOverviewOptionsTooltip": "Options", "@todosOverviewOptionsTooltip": { "description": "Tooltip text shown in the options dropdown of the Todos Overview Page" }, "todosOverviewOptionsMarkAllComplete": "Mark all as completed", "@todosOverviewOptionsMarkAllComplete": { "description": "Button text shown in the options dropdown of the Todos Overview Page that marks all todos as complete" }, "todosOverviewOptionsMarkAllIncomplete": "Mark all as incomplete", "@todosOverviewOptionsMarkAllIncomplete": { "description": "Button text shown in the options dropdown of the Todos Overview Page that marks all todos as incomplete" }, "todosOverviewOptionsClearCompleted": "Clear completed", "@todosOverviewOptionsClearCompleted": { "description": "Button text shown in the options dropdown of the Todos Overview Page that deletes all completed todos" }, "todoDetailsAppBarTitle": "Todo Details", "@todoDetailsAppBarTitle": { "description": "Title text shown in the AppBar of the Todo Details Page" }, "todoDetailsDeleteButtonTooltip": "Delete", "@todoDetailsDeleteButtonTooltip": { "description": "Tooltip text shown in the delete button on the Todo Details Page" }, "todoDetailsEditButtonTooltip": "Edit", "@todoDetailsEditButtonTooltip": { "description": "Tooltip text shown in the edit button on the Todo Details Page" }, "editTodoEditAppBarTitle": "Edit Todo", "@editTodoEditAppBarTitle": { "description": "Title text shown in the AppBar of the Todo Edit Page when editing an existing todo" }, "editTodoAddAppBarTitle": "Add Todo", "@editTodoAddAppBarTitle": { "description": "Title text shown in the AppBar of the Todo Edit Page when adding a new todo" }, "editTodoTitleLabel": "Title", "@editTodoTitleLabel": { "description": "Label text shown in the title input field of the Todo Edit Page" }, "editTodoDescriptionLabel": "Description", "@editTodoDescriptionLabel": { "description": "Label text shown in the description input field of the Todo Edit Page" }, "editTodoSaveButtonTooltip": "Save changes", "@editTodoSaveButtonTooltip": { "description": "Tooltip text shown in the save button on the Todo Edit Page" }, "statsAppBarTitle": "Stats", "@statsAppBarTitle": { "description": "Title text shown in the AppBar of the Stats Page" }, "statsCompletedTodoCountLabel": "Completed todos", "@statsCompletedTodoCountLabel": { "description": "Label text shown in the completed todos count section of the Stats Page" }, "statsActiveTodoCountLabel": "Active todos", "@statsActiveTodoCountLabel": { "description": "Label text shown in the active todos count section of the Stats Page" } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/l10n/l10n.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; export 'package:flutter_gen/gen_l10n/app_localizations.dart'; extension AppLocalizationsX on BuildContext { AppLocalizations get l10n => AppLocalizations.of(this); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/main_development.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_todos/bootstrap.dart'; import 'package:local_storage_todos_api/local_storage_todos_api.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final todosApi = LocalStorageTodosApi( plugin: await SharedPreferences.getInstance(), ); bootstrap(todosApi: todosApi); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/main_production.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_todos/bootstrap.dart'; import 'package:local_storage_todos_api/local_storage_todos_api.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final todosApi = LocalStorageTodosApi( plugin: await SharedPreferences.getInstance(), ); bootstrap(todosApi: todosApi); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/main_staging.dart ================================================ import 'package:flutter/widgets.dart'; import 'package:flutter_todos/bootstrap.dart'; import 'package:local_storage_todos_api/local_storage_todos_api.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final todosApi = LocalStorageTodosApi( plugin: await SharedPreferences.getInstance(), ); bootstrap(todosApi: todosApi); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/bloc/stats_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:todos_repository/todos_repository.dart'; part 'stats_event.dart'; part 'stats_state.dart'; class StatsBloc extends Bloc<StatsEvent, StatsState> { StatsBloc({ required TodosRepository todosRepository, }) : _todosRepository = todosRepository, super(const StatsState()) { on<StatsSubscriptionRequested>(_onSubscriptionRequested); } final TodosRepository _todosRepository; Future<void> _onSubscriptionRequested( StatsSubscriptionRequested event, Emitter<StatsState> emit, ) async { emit(state.copyWith(status: StatsStatus.loading)); await emit.forEach<List<Todo>>( _todosRepository.getTodos(), onData: (todos) => state.copyWith( status: StatsStatus.success, completedTodos: todos.where((todo) => todo.isCompleted).length, activeTodos: todos.where((todo) => !todo.isCompleted).length, ), onError: (_, __) => state.copyWith(status: StatsStatus.failure), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/bloc/stats_event.dart ================================================ part of 'stats_bloc.dart'; sealed class StatsEvent extends Equatable { const StatsEvent(); @override List<Object> get props => []; } final class StatsSubscriptionRequested extends StatsEvent { const StatsSubscriptionRequested(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/bloc/stats_state.dart ================================================ part of 'stats_bloc.dart'; enum StatsStatus { initial, loading, success, failure } final class StatsState extends Equatable { const StatsState({ this.status = StatsStatus.initial, this.completedTodos = 0, this.activeTodos = 0, }); final StatsStatus status; final int completedTodos; final int activeTodos; @override List<Object> get props => [status, completedTodos, activeTodos]; StatsState copyWith({ StatsStatus? status, int? completedTodos, int? activeTodos, }) { return StatsState( status: status ?? this.status, completedTodos: completedTodos ?? this.completedTodos, activeTodos: activeTodos ?? this.activeTodos, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/stats.dart ================================================ export 'bloc/stats_bloc.dart'; export 'view/view.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/view/stats_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:flutter_todos/stats/stats.dart'; import 'package:todos_repository/todos_repository.dart'; class StatsPage extends StatelessWidget { const StatsPage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (context) => StatsBloc( todosRepository: context.read<TodosRepository>(), )..add(const StatsSubscriptionRequested()), child: const StatsView(), ); } } class StatsView extends StatelessWidget { const StatsView({super.key}); @override Widget build(BuildContext context) { final l10n = context.l10n; final state = context.watch<StatsBloc>().state; final textTheme = Theme.of(context).textTheme; return Scaffold( appBar: AppBar( title: Text(l10n.statsAppBarTitle), ), body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ListTile( key: const Key('statsView_completedTodos_listTile'), leading: const Icon(Icons.check_rounded), title: Text(l10n.statsCompletedTodoCountLabel), trailing: Text( '${state.completedTodos}', style: textTheme.headlineSmall, ), ), ListTile( key: const Key('statsView_activeTodos_listTile'), leading: const Icon(Icons.radio_button_unchecked_rounded), title: Text(l10n.statsActiveTodoCountLabel), trailing: Text( '${state.activeTodos}', style: textTheme.headlineSmall, ), ), ], ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/stats/view/view.dart ================================================ export 'stats_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/theme/theme.dart ================================================ import 'package:flutter/material.dart'; class FlutterTodosTheme { static ThemeData get light { return ThemeData( appBarTheme: const AppBarTheme( color: Color(0xFF13B9FF), ), colorScheme: ColorScheme.fromSwatch( accentColor: const Color(0xFF13B9FF), ), snackBarTheme: const SnackBarThemeData( behavior: SnackBarBehavior.floating, ), ); } static ThemeData get dark { return ThemeData( appBarTheme: const AppBarTheme( color: Color(0xFF13B9FF), ), colorScheme: ColorScheme.fromSwatch( brightness: Brightness.dark, accentColor: const Color(0xFF13B9FF), ), snackBarTheme: const SnackBarThemeData( behavior: SnackBarBehavior.floating, ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/bloc/todos_overview_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter_todos/todos_overview/todos_overview.dart'; import 'package:todos_repository/todos_repository.dart'; part 'todos_overview_event.dart'; part 'todos_overview_state.dart'; class TodosOverviewBloc extends Bloc<TodosOverviewEvent, TodosOverviewState> { TodosOverviewBloc({ required TodosRepository todosRepository, }) : _todosRepository = todosRepository, super(const TodosOverviewState()) { on<TodosOverviewSubscriptionRequested>(_onSubscriptionRequested); on<TodosOverviewTodoCompletionToggled>(_onTodoCompletionToggled); on<TodosOverviewTodoDeleted>(_onTodoDeleted); on<TodosOverviewUndoDeletionRequested>(_onUndoDeletionRequested); on<TodosOverviewFilterChanged>(_onFilterChanged); on<TodosOverviewToggleAllRequested>(_onToggleAllRequested); on<TodosOverviewClearCompletedRequested>(_onClearCompletedRequested); } final TodosRepository _todosRepository; Future<void> _onSubscriptionRequested( TodosOverviewSubscriptionRequested event, Emitter<TodosOverviewState> emit, ) async { emit(state.copyWith(status: () => TodosOverviewStatus.loading)); await emit.forEach<List<Todo>>( _todosRepository.getTodos(), onData: (todos) => state.copyWith( status: () => TodosOverviewStatus.success, todos: () => todos, ), onError: (_, __) => state.copyWith( status: () => TodosOverviewStatus.failure, ), ); } Future<void> _onTodoCompletionToggled( TodosOverviewTodoCompletionToggled event, Emitter<TodosOverviewState> emit, ) async { final newTodo = event.todo.copyWith(isCompleted: event.isCompleted); await _todosRepository.saveTodo(newTodo); } Future<void> _onTodoDeleted( TodosOverviewTodoDeleted event, Emitter<TodosOverviewState> emit, ) async { emit(state.copyWith(lastDeletedTodo: () => event.todo)); await _todosRepository.deleteTodo(event.todo.id); } Future<void> _onUndoDeletionRequested( TodosOverviewUndoDeletionRequested event, Emitter<TodosOverviewState> emit, ) async { assert( state.lastDeletedTodo != null, 'Last deleted todo can not be null.', ); final todo = state.lastDeletedTodo!; emit(state.copyWith(lastDeletedTodo: () => null)); await _todosRepository.saveTodo(todo); } void _onFilterChanged( TodosOverviewFilterChanged event, Emitter<TodosOverviewState> emit, ) { emit(state.copyWith(filter: () => event.filter)); } Future<void> _onToggleAllRequested( TodosOverviewToggleAllRequested event, Emitter<TodosOverviewState> emit, ) async { final areAllCompleted = state.todos.every((todo) => todo.isCompleted); await _todosRepository.completeAll(isCompleted: !areAllCompleted); } Future<void> _onClearCompletedRequested( TodosOverviewClearCompletedRequested event, Emitter<TodosOverviewState> emit, ) async { await _todosRepository.clearCompleted(); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/bloc/todos_overview_event.dart ================================================ part of 'todos_overview_bloc.dart'; sealed class TodosOverviewEvent extends Equatable { const TodosOverviewEvent(); @override List<Object> get props => []; } final class TodosOverviewSubscriptionRequested extends TodosOverviewEvent { const TodosOverviewSubscriptionRequested(); } final class TodosOverviewTodoCompletionToggled extends TodosOverviewEvent { const TodosOverviewTodoCompletionToggled({ required this.todo, required this.isCompleted, }); final Todo todo; final bool isCompleted; @override List<Object> get props => [todo, isCompleted]; } final class TodosOverviewTodoDeleted extends TodosOverviewEvent { const TodosOverviewTodoDeleted(this.todo); final Todo todo; @override List<Object> get props => [todo]; } final class TodosOverviewUndoDeletionRequested extends TodosOverviewEvent { const TodosOverviewUndoDeletionRequested(); } class TodosOverviewFilterChanged extends TodosOverviewEvent { const TodosOverviewFilterChanged(this.filter); final TodosViewFilter filter; @override List<Object> get props => [filter]; } class TodosOverviewToggleAllRequested extends TodosOverviewEvent { const TodosOverviewToggleAllRequested(); } class TodosOverviewClearCompletedRequested extends TodosOverviewEvent { const TodosOverviewClearCompletedRequested(); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/bloc/todos_overview_state.dart ================================================ part of 'todos_overview_bloc.dart'; enum TodosOverviewStatus { initial, loading, success, failure } final class TodosOverviewState extends Equatable { const TodosOverviewState({ this.status = TodosOverviewStatus.initial, this.todos = const [], this.filter = TodosViewFilter.all, this.lastDeletedTodo, }); final TodosOverviewStatus status; final List<Todo> todos; final TodosViewFilter filter; final Todo? lastDeletedTodo; Iterable<Todo> get filteredTodos => filter.applyAll(todos); TodosOverviewState copyWith({ TodosOverviewStatus Function()? status, List<Todo> Function()? todos, TodosViewFilter Function()? filter, Todo? Function()? lastDeletedTodo, }) { return TodosOverviewState( status: status != null ? status() : this.status, todos: todos != null ? todos() : this.todos, filter: filter != null ? filter() : this.filter, lastDeletedTodo: lastDeletedTodo != null ? lastDeletedTodo() : this.lastDeletedTodo, ); } @override List<Object?> get props => [ status, todos, filter, lastDeletedTodo, ]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/models/models.dart ================================================ export 'todos_view_filter.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/models/todos_view_filter.dart ================================================ import 'package:todos_repository/todos_repository.dart'; enum TodosViewFilter { all, activeOnly, completedOnly } extension TodosViewFilterX on TodosViewFilter { bool apply(Todo todo) { switch (this) { case TodosViewFilter.all: return true; case TodosViewFilter.activeOnly: return !todo.isCompleted; case TodosViewFilter.completedOnly: return todo.isCompleted; } } Iterable<Todo> applyAll(Iterable<Todo> todos) { return todos.where(apply); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/todos_overview.dart ================================================ export 'bloc/todos_overview_bloc.dart'; export 'models/models.dart'; export 'view/view.dart'; export 'widgets/widgets.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/view/todos_overview_page.dart ================================================ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/edit_todo/view/edit_todo_page.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:flutter_todos/todos_overview/todos_overview.dart'; import 'package:todos_repository/todos_repository.dart'; class TodosOverviewPage extends StatelessWidget { const TodosOverviewPage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (context) => TodosOverviewBloc( todosRepository: context.read<TodosRepository>(), )..add(const TodosOverviewSubscriptionRequested()), child: const TodosOverviewView(), ); } } class TodosOverviewView extends StatelessWidget { const TodosOverviewView({super.key}); @override Widget build(BuildContext context) { final l10n = context.l10n; return Scaffold( appBar: AppBar( title: Text(l10n.todosOverviewAppBarTitle), actions: const [ TodosOverviewFilterButton(), TodosOverviewOptionsButton(), ], ), body: MultiBlocListener( listeners: [ BlocListener<TodosOverviewBloc, TodosOverviewState>( listenWhen: (previous, current) => previous.status != current.status, listener: (context, state) { if (state.status == TodosOverviewStatus.failure) { ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar( SnackBar( content: Text(l10n.todosOverviewErrorSnackbarText), ), ); } }, ), BlocListener<TodosOverviewBloc, TodosOverviewState>( listenWhen: (previous, current) => previous.lastDeletedTodo != current.lastDeletedTodo && current.lastDeletedTodo != null, listener: (context, state) { final deletedTodo = state.lastDeletedTodo!; final messenger = ScaffoldMessenger.of(context); messenger ..hideCurrentSnackBar() ..showSnackBar( SnackBar( content: Text( l10n.todosOverviewTodoDeletedSnackbarText( deletedTodo.title, ), ), action: SnackBarAction( label: l10n.todosOverviewUndoDeletionButtonText, onPressed: () { messenger.hideCurrentSnackBar(); context .read<TodosOverviewBloc>() .add(const TodosOverviewUndoDeletionRequested()); }, ), ), ); }, ), ], child: BlocBuilder<TodosOverviewBloc, TodosOverviewState>( builder: (context, state) { if (state.todos.isEmpty) { if (state.status == TodosOverviewStatus.loading) { return const Center(child: CupertinoActivityIndicator()); } else if (state.status != TodosOverviewStatus.success) { return const SizedBox(); } else { return Center( child: Text( l10n.todosOverviewEmptyText, style: Theme.of(context).textTheme.bodySmall, ), ); } } return CupertinoScrollbar( child: ListView( children: [ for (final todo in state.filteredTodos) TodoListTile( todo: todo, onToggleCompleted: (isCompleted) { context.read<TodosOverviewBloc>().add( TodosOverviewTodoCompletionToggled( todo: todo, isCompleted: isCompleted, ), ); }, onDismissed: (_) { context .read<TodosOverviewBloc>() .add(TodosOverviewTodoDeleted(todo)); }, onTap: () { Navigator.of(context).push( EditTodoPage.route(initialTodo: todo), ); }, ), ], ), ); }, ), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/view/view.dart ================================================ export 'todos_overview_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/widgets/todo_list_tile.dart ================================================ import 'package:flutter/material.dart'; import 'package:todos_repository/todos_repository.dart'; class TodoListTile extends StatelessWidget { const TodoListTile({ required this.todo, super.key, this.onToggleCompleted, this.onDismissed, this.onTap, }); final Todo todo; final ValueChanged<bool>? onToggleCompleted; final DismissDirectionCallback? onDismissed; final VoidCallback? onTap; @override Widget build(BuildContext context) { final theme = Theme.of(context); final captionColor = theme.textTheme.bodySmall?.color; return Dismissible( key: Key('todoListTile_dismissible_${todo.id}'), onDismissed: onDismissed, direction: DismissDirection.endToStart, background: Container( alignment: Alignment.centerRight, color: theme.colorScheme.error, padding: const EdgeInsets.symmetric(horizontal: 16), child: const Icon( Icons.delete, color: Color(0xAAFFFFFF), ), ), child: ListTile( onTap: onTap, title: Text( todo.title, maxLines: 1, overflow: TextOverflow.ellipsis, style: !todo.isCompleted ? null : TextStyle( color: captionColor, decoration: TextDecoration.lineThrough, ), ), subtitle: Text( todo.description, maxLines: 1, overflow: TextOverflow.ellipsis, ), leading: Checkbox( shape: const ContinuousRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(8)), ), value: todo.isCompleted, onChanged: onToggleCompleted == null ? null : (value) => onToggleCompleted!(value!), ), trailing: onTap == null ? null : const Icon(Icons.chevron_right), ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/widgets/todos_overview_filter_button.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:flutter_todos/todos_overview/todos_overview.dart'; class TodosOverviewFilterButton extends StatelessWidget { const TodosOverviewFilterButton({super.key}); @override Widget build(BuildContext context) { final l10n = context.l10n; final activeFilter = context.select((TodosOverviewBloc bloc) => bloc.state.filter); return PopupMenuButton<TodosViewFilter>( shape: const ContinuousRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(16)), ), initialValue: activeFilter, tooltip: l10n.todosOverviewFilterTooltip, onSelected: (filter) { context .read<TodosOverviewBloc>() .add(TodosOverviewFilterChanged(filter)); }, itemBuilder: (context) { return [ PopupMenuItem( value: TodosViewFilter.all, child: Text(l10n.todosOverviewFilterAll), ), PopupMenuItem( value: TodosViewFilter.activeOnly, child: Text(l10n.todosOverviewFilterActiveOnly), ), PopupMenuItem( value: TodosViewFilter.completedOnly, child: Text(l10n.todosOverviewFilterCompletedOnly), ), ]; }, icon: const Icon(Icons.filter_list_rounded), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/widgets/todos_overview_options_button.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_todos/l10n/l10n.dart'; import 'package:flutter_todos/todos_overview/todos_overview.dart'; @visibleForTesting enum TodosOverviewOption { toggleAll, clearCompleted } class TodosOverviewOptionsButton extends StatelessWidget { const TodosOverviewOptionsButton({super.key}); @override Widget build(BuildContext context) { final l10n = context.l10n; final todos = context.select((TodosOverviewBloc bloc) => bloc.state.todos); final hasTodos = todos.isNotEmpty; final completedTodosAmount = todos.where((todo) => todo.isCompleted).length; return PopupMenuButton<TodosOverviewOption>( shape: const ContinuousRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(16)), ), tooltip: l10n.todosOverviewOptionsTooltip, onSelected: (options) { switch (options) { case TodosOverviewOption.toggleAll: context .read<TodosOverviewBloc>() .add(const TodosOverviewToggleAllRequested()); case TodosOverviewOption.clearCompleted: context .read<TodosOverviewBloc>() .add(const TodosOverviewClearCompletedRequested()); } }, itemBuilder: (context) { return [ PopupMenuItem( value: TodosOverviewOption.toggleAll, enabled: hasTodos, child: Text( completedTodosAmount == todos.length ? l10n.todosOverviewOptionsMarkAllIncomplete : l10n.todosOverviewOptionsMarkAllComplete, ), ), PopupMenuItem( value: TodosOverviewOption.clearCompleted, enabled: hasTodos && completedTodosAmount > 0, child: Text(l10n.todosOverviewOptionsClearCompleted), ), ]; }, icon: const Icon(Icons.more_vert_rounded), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_todos/todos_overview/widgets/widgets.dart ================================================ export 'todo_list_tile.dart'; export 'todos_overview_filter_button.dart'; export 'todos_overview_options_button.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # Visual Studio Code related .vscode/ # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile /android/app/release ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: linux create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: macos create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: windows create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/app.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_weather/theme/theme.dart'; import 'package:flutter_weather/weather/weather.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:weather_repository/weather_repository.dart'; class WeatherApp extends StatelessWidget { const WeatherApp({required WeatherRepository weatherRepository, super.key}) : _weatherRepository = weatherRepository; final WeatherRepository _weatherRepository; @override Widget build(BuildContext context) { return RepositoryProvider.value( value: _weatherRepository, child: BlocProvider( create: (_) => ThemeCubit(), child: const WeatherAppView(), ), ); } } class WeatherAppView extends StatelessWidget { const WeatherAppView({super.key}); @override Widget build(BuildContext context) { final textTheme = Theme.of(context).textTheme; return BlocBuilder<ThemeCubit, Color>( builder: (context, color) { return MaterialApp( theme: ThemeData( primaryColor: color, textTheme: GoogleFonts.rajdhaniTextTheme(), appBarTheme: AppBarTheme( titleTextStyle: GoogleFonts.rajdhaniTextTheme(textTheme) .apply(bodyColor: Colors.white) .titleLarge, ), ), home: const WeatherPage(), ); }, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/main.dart ================================================ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_weather/app.dart'; import 'package:flutter_weather/weather_bloc_observer.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart'; import 'package:path_provider/path_provider.dart'; import 'package:weather_repository/weather_repository.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); Bloc.observer = const WeatherBlocObserver(); HydratedBloc.storage = await HydratedStorage.build( storageDirectory: kIsWeb ? HydratedStorage.webStorageDirectory : await getTemporaryDirectory(), ); runApp(WeatherApp(weatherRepository: WeatherRepository())); } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/search/search.dart ================================================ export 'view/search_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/search/view/search_page.dart ================================================ import 'package:flutter/material.dart'; class SearchPage extends StatefulWidget { const SearchPage._(); static Route<String> route() { return MaterialPageRoute(builder: (_) => const SearchPage._()); } @override State<SearchPage> createState() => _SearchPageState(); } class _SearchPageState extends State<SearchPage> { final TextEditingController _textController = TextEditingController(); String get _text => _textController.text; @override void dispose() { _textController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('City Search')), body: Row( children: [ Expanded( child: Padding( padding: const EdgeInsets.all(8), child: TextField( controller: _textController, decoration: const InputDecoration( labelText: 'City', hintText: 'Chicago', ), ), ), ), IconButton( key: const Key('searchPage_search_iconButton'), icon: const Icon(Icons.search, semanticLabel: 'Submit'), onPressed: () => Navigator.of(context).pop(_text), ), ], ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/settings/settings.dart ================================================ export 'view/settings_page.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/settings/view/settings_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_weather/weather/weather.dart'; class SettingsPage extends StatelessWidget { const SettingsPage._(); static Route<void> route(WeatherCubit weatherCubit) { return MaterialPageRoute<void>( builder: (_) => BlocProvider.value( value: weatherCubit, child: const SettingsPage._(), ), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Settings')), body: ListView( children: <Widget>[ BlocBuilder<WeatherCubit, WeatherState>( buildWhen: (previous, current) => previous.temperatureUnits != current.temperatureUnits, builder: (context, state) { return ListTile( title: const Text('Temperature Units'), isThreeLine: true, subtitle: const Text( 'Use metric measurements for temperature units.', ), trailing: Switch( value: state.temperatureUnits.isCelsius, onChanged: (_) => context.read<WeatherCubit>().toggleUnits(), ), ); }, ), ], ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/theme/cubit/theme_cubit.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_weather/weather/weather.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart'; class ThemeCubit extends HydratedCubit<Color> { ThemeCubit() : super(defaultColor); static const defaultColor = Color(0xFF2196F3); void updateTheme(Weather? weather) { if (weather != null) emit(weather.toColor); } @override Color fromJson(Map<String, dynamic> json) { return Color(int.parse(json['color'] as String)); } @override Map<String, dynamic> toJson(Color state) { return <String, String>{'color': '${state.value}'}; } } extension on Weather { Color get toColor { switch (condition) { case WeatherCondition.clear: return Colors.orangeAccent; case WeatherCondition.snowy: return Colors.lightBlueAccent; case WeatherCondition.cloudy: return Colors.blueGrey; case WeatherCondition.rainy: return Colors.indigoAccent; case WeatherCondition.unknown: return ThemeCubit.defaultColor; } } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/theme/theme.dart ================================================ export 'cubit/theme_cubit.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/cubit/weather_cubit.dart ================================================ import 'package:equatable/equatable.dart'; import 'package:flutter_weather/weather/weather.dart'; import 'package:hydrated_bloc/hydrated_bloc.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:weather_repository/weather_repository.dart' show WeatherRepository; part 'weather_cubit.g.dart'; part 'weather_state.dart'; class WeatherCubit extends HydratedCubit<WeatherState> { WeatherCubit(this._weatherRepository) : super(WeatherState()); final WeatherRepository _weatherRepository; Future<void> fetchWeather(String? city) async { if (city == null || city.isEmpty) return; emit(state.copyWith(status: WeatherStatus.loading)); try { final weather = Weather.fromRepository( await _weatherRepository.getWeather(city), ); final units = state.temperatureUnits; final value = units.isFahrenheit ? weather.temperature.value.toFahrenheit() : weather.temperature.value; emit( state.copyWith( status: WeatherStatus.success, temperatureUnits: units, weather: weather.copyWith(temperature: Temperature(value: value)), ), ); } on Exception { emit(state.copyWith(status: WeatherStatus.failure)); } } Future<void> refreshWeather() async { if (!state.status.isSuccess) return; if (state.weather == Weather.empty) return; try { final weather = Weather.fromRepository( await _weatherRepository.getWeather(state.weather.location), ); final units = state.temperatureUnits; final value = units.isFahrenheit ? weather.temperature.value.toFahrenheit() : weather.temperature.value; emit( state.copyWith( status: WeatherStatus.success, temperatureUnits: units, weather: weather.copyWith(temperature: Temperature(value: value)), ), ); } on Exception { emit(state); } } void toggleUnits() { final units = state.temperatureUnits.isFahrenheit ? TemperatureUnits.celsius : TemperatureUnits.fahrenheit; if (!state.status.isSuccess) { emit(state.copyWith(temperatureUnits: units)); return; } final weather = state.weather; if (weather != Weather.empty) { final temperature = weather.temperature; final value = units.isCelsius ? temperature.value.toCelsius() : temperature.value.toFahrenheit(); emit( state.copyWith( temperatureUnits: units, weather: weather.copyWith(temperature: Temperature(value: value)), ), ); } } @override WeatherState fromJson(Map<String, dynamic> json) => WeatherState.fromJson(json); @override Map<String, dynamic> toJson(WeatherState state) => state.toJson(); } extension on double { double toFahrenheit() => (this * 9 / 5) + 32; double toCelsius() => (this - 32) * 5 / 9; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/cubit/weather_cubit.g.dart ================================================ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'weather_cubit.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** WeatherState _$WeatherStateFromJson(Map<String, dynamic> json) => $checkedCreate( 'WeatherState', json, ($checkedConvert) { final val = WeatherState( status: $checkedConvert( 'status', (v) => $enumDecodeNullable(_$WeatherStatusEnumMap, v) ?? WeatherStatus.initial), temperatureUnits: $checkedConvert( 'temperature_units', (v) => $enumDecodeNullable(_$TemperatureUnitsEnumMap, v) ?? TemperatureUnits.celsius), weather: $checkedConvert( 'weather', (v) => v == null ? null : Weather.fromJson(v as Map<String, dynamic>)), ); return val; }, fieldKeyMap: const {'temperatureUnits': 'temperature_units'}, ); Map<String, dynamic> _$WeatherStateToJson(WeatherState instance) => <String, dynamic>{ 'status': _$WeatherStatusEnumMap[instance.status]!, 'weather': instance.weather.toJson(), 'temperature_units': _$TemperatureUnitsEnumMap[instance.temperatureUnits]!, }; const _$WeatherStatusEnumMap = { WeatherStatus.initial: 'initial', WeatherStatus.loading: 'loading', WeatherStatus.success: 'success', WeatherStatus.failure: 'failure', }; const _$TemperatureUnitsEnumMap = { TemperatureUnits.fahrenheit: 'fahrenheit', TemperatureUnits.celsius: 'celsius', }; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/cubit/weather_state.dart ================================================ part of 'weather_cubit.dart'; enum WeatherStatus { initial, loading, success, failure } extension WeatherStatusX on WeatherStatus { bool get isInitial => this == WeatherStatus.initial; bool get isLoading => this == WeatherStatus.loading; bool get isSuccess => this == WeatherStatus.success; bool get isFailure => this == WeatherStatus.failure; } @JsonSerializable() final class WeatherState extends Equatable { WeatherState({ this.status = WeatherStatus.initial, this.temperatureUnits = TemperatureUnits.celsius, Weather? weather, }) : weather = weather ?? Weather.empty; factory WeatherState.fromJson(Map<String, dynamic> json) => _$WeatherStateFromJson(json); final WeatherStatus status; final Weather weather; final TemperatureUnits temperatureUnits; WeatherState copyWith({ WeatherStatus? status, TemperatureUnits? temperatureUnits, Weather? weather, }) { return WeatherState( status: status ?? this.status, temperatureUnits: temperatureUnits ?? this.temperatureUnits, weather: weather ?? this.weather, ); } Map<String, dynamic> toJson() => _$WeatherStateToJson(this); @override List<Object?> get props => [status, temperatureUnits, weather]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/models/models.dart ================================================ export 'weather.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/models/weather.dart ================================================ import 'package:equatable/equatable.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:weather_repository/weather_repository.dart' hide Weather; import 'package:weather_repository/weather_repository.dart' as weather_repository; part 'weather.g.dart'; enum TemperatureUnits { fahrenheit, celsius } extension TemperatureUnitsX on TemperatureUnits { bool get isFahrenheit => this == TemperatureUnits.fahrenheit; bool get isCelsius => this == TemperatureUnits.celsius; } @JsonSerializable() class Temperature extends Equatable { const Temperature({required this.value}); factory Temperature.fromJson(Map<String, dynamic> json) => _$TemperatureFromJson(json); final double value; Map<String, dynamic> toJson() => _$TemperatureToJson(this); @override List<Object> get props => [value]; } @JsonSerializable() class Weather extends Equatable { const Weather({ required this.condition, required this.lastUpdated, required this.location, required this.temperature, }); factory Weather.fromJson(Map<String, dynamic> json) => _$WeatherFromJson(json); factory Weather.fromRepository(weather_repository.Weather weather) { return Weather( condition: weather.condition, lastUpdated: DateTime.now(), location: weather.location, temperature: Temperature(value: weather.temperature), ); } static final empty = Weather( condition: WeatherCondition.unknown, lastUpdated: DateTime(0), temperature: const Temperature(value: 0), location: '--', ); final WeatherCondition condition; final DateTime lastUpdated; final String location; final Temperature temperature; @override List<Object> get props => [condition, lastUpdated, location, temperature]; Map<String, dynamic> toJson() => _$WeatherToJson(this); Weather copyWith({ WeatherCondition? condition, DateTime? lastUpdated, String? location, Temperature? temperature, }) { return Weather( condition: condition ?? this.condition, lastUpdated: lastUpdated ?? this.lastUpdated, location: location ?? this.location, temperature: temperature ?? this.temperature, ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/models/weather.g.dart ================================================ // GENERATED CODE - DO NOT MODIFY BY HAND part of 'weather.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** Temperature _$TemperatureFromJson(Map<String, dynamic> json) => $checkedCreate( 'Temperature', json, ($checkedConvert) { final val = Temperature( value: $checkedConvert('value', (v) => (v as num).toDouble()), ); return val; }, ); Map<String, dynamic> _$TemperatureToJson(Temperature instance) => <String, dynamic>{ 'value': instance.value, }; Weather _$WeatherFromJson(Map<String, dynamic> json) => $checkedCreate( 'Weather', json, ($checkedConvert) { final val = Weather( condition: $checkedConvert( 'condition', (v) => $enumDecode(_$WeatherConditionEnumMap, v)), lastUpdated: $checkedConvert( 'last_updated', (v) => DateTime.parse(v as String)), location: $checkedConvert('location', (v) => v as String), temperature: $checkedConvert('temperature', (v) => Temperature.fromJson(v as Map<String, dynamic>)), ); return val; }, fieldKeyMap: const {'lastUpdated': 'last_updated'}, ); Map<String, dynamic> _$WeatherToJson(Weather instance) => <String, dynamic>{ 'condition': _$WeatherConditionEnumMap[instance.condition]!, 'last_updated': instance.lastUpdated.toIso8601String(), 'location': instance.location, 'temperature': instance.temperature.toJson(), }; const _$WeatherConditionEnumMap = { WeatherCondition.clear: 'clear', WeatherCondition.rainy: 'rainy', WeatherCondition.cloudy: 'cloudy', WeatherCondition.snowy: 'snowy', WeatherCondition.unknown: 'unknown', }; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/view/weather_page.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_weather/search/search.dart'; import 'package:flutter_weather/settings/settings.dart'; import 'package:flutter_weather/theme/theme.dart'; import 'package:flutter_weather/weather/weather.dart'; import 'package:weather_repository/weather_repository.dart'; class WeatherPage extends StatelessWidget { const WeatherPage({super.key}); @override Widget build(BuildContext context) { return BlocProvider( create: (context) => WeatherCubit(context.read<WeatherRepository>()), child: const WeatherView(), ); } } class WeatherView extends StatefulWidget { const WeatherView({super.key}); @override State<WeatherView> createState() => _WeatherViewState(); } class _WeatherViewState extends State<WeatherView> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Flutter Weather'), actions: [ IconButton( icon: const Icon(Icons.settings), onPressed: () { Navigator.of(context).push<void>( SettingsPage.route( context.read<WeatherCubit>(), ), ); }, ), ], ), body: Center( child: BlocConsumer<WeatherCubit, WeatherState>( listener: (context, state) { if (state.status.isSuccess) { context.read<ThemeCubit>().updateTheme(state.weather); } }, builder: (context, state) { switch (state.status) { case WeatherStatus.initial: return const WeatherEmpty(); case WeatherStatus.loading: return const WeatherLoading(); case WeatherStatus.success: return WeatherPopulated( weather: state.weather, units: state.temperatureUnits, onRefresh: () { return context.read<WeatherCubit>().refreshWeather(); }, ); case WeatherStatus.failure: return const WeatherError(); } }, ), ), floatingActionButton: FloatingActionButton( child: const Icon(Icons.search, semanticLabel: 'Search'), onPressed: () async { final city = await Navigator.of(context).push(SearchPage.route()); if (!mounted) return; await context.read<WeatherCubit>().fetchWeather(city); }, ), ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/weather.dart ================================================ export 'package:weather_repository/weather_repository.dart' show WeatherCondition; export 'cubit/weather_cubit.dart'; export 'models/models.dart'; export 'view/weather_page.dart'; export 'widgets/widgets.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/widgets/weather_empty.dart ================================================ import 'package:flutter/material.dart'; class WeatherEmpty extends StatelessWidget { const WeatherEmpty({super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Column( mainAxisSize: MainAxisSize.min, children: [ const Text('🏙️', style: TextStyle(fontSize: 64)), Text( 'Please Select a City!', style: theme.textTheme.headlineSmall, ), ], ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/widgets/weather_error.dart ================================================ import 'package:flutter/material.dart'; class WeatherError extends StatelessWidget { const WeatherError({super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Column( mainAxisSize: MainAxisSize.min, children: [ const Text('🙈', style: TextStyle(fontSize: 64)), Text( 'Something went wrong!', style: theme.textTheme.headlineSmall, ), ], ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/widgets/weather_loading.dart ================================================ import 'package:flutter/material.dart'; class WeatherLoading extends StatelessWidget { const WeatherLoading({super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); return Column( mainAxisSize: MainAxisSize.min, children: [ const Text('⛅', style: TextStyle(fontSize: 64)), Text( 'Loading Weather', style: theme.textTheme.headlineSmall, ), const Padding( padding: EdgeInsets.all(16), child: CircularProgressIndicator(), ), ], ); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/widgets/weather_populated.dart ================================================ import 'package:flutter/material.dart'; import 'package:flutter_weather/weather/weather.dart'; class WeatherPopulated extends StatelessWidget { const WeatherPopulated({ required this.weather, required this.units, required this.onRefresh, super.key, }); final Weather weather; final TemperatureUnits units; final ValueGetter<Future<void>> onRefresh; @override Widget build(BuildContext context) { final theme = Theme.of(context); return Stack( children: [ _WeatherBackground(), RefreshIndicator( onRefresh: onRefresh, child: SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), clipBehavior: Clip.none, child: Center( child: Column( children: [ const SizedBox(height: 48), _WeatherIcon(condition: weather.condition), Text( weather.location, style: theme.textTheme.displayMedium?.copyWith( fontWeight: FontWeight.w200, ), ), Text( weather.formattedTemperature(units), style: theme.textTheme.displaySmall?.copyWith( fontWeight: FontWeight.bold, ), ), Text( '''Last Updated at ${TimeOfDay.fromDateTime(weather.lastUpdated).format(context)}''', ), ], ), ), ), ), ], ); } } class _WeatherIcon extends StatelessWidget { const _WeatherIcon({required this.condition}); static const _iconSize = 75.0; final WeatherCondition condition; @override Widget build(BuildContext context) { return Text( condition.toEmoji, style: const TextStyle(fontSize: _iconSize), ); } } extension on WeatherCondition { String get toEmoji { switch (this) { case WeatherCondition.clear: return '☀️'; case WeatherCondition.rainy: return '🌧️'; case WeatherCondition.cloudy: return '☁️'; case WeatherCondition.snowy: return '🌨️'; case WeatherCondition.unknown: return '❓'; } } } class _WeatherBackground extends StatelessWidget { @override Widget build(BuildContext context) { final color = Theme.of(context).primaryColor; return SizedBox.expand( child: DecoratedBox( decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, stops: const [0.25, 0.75, 0.90, 1.0], colors: [ color, color.brighten(), color.brighten(33), color.brighten(50), ], ), ), ), ); } } extension on Color { Color brighten([int percent = 10]) { assert( 1 <= percent && percent <= 100, 'percentage must be between 1 and 100', ); final p = percent / 100; return Color.fromARGB( alpha, red + ((255 - red) * p).round(), green + ((255 - green) * p).round(), blue + ((255 - blue) * p).round(), ); } } extension on Weather { String formattedTemperature(TemperatureUnits units) { return '''${temperature.value.toStringAsPrecision(2)}°${units.isCelsius ? 'C' : 'F'}'''; } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather/widgets/widgets.dart ================================================ export 'weather_empty.dart'; export 'weather_error.dart'; export 'weather_loading.dart'; export 'weather_populated.dart'; ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_weather/weather_bloc_observer.dart ================================================ import 'dart:developer'; import 'package:bloc/bloc.dart'; class WeatherBlocObserver extends BlocObserver { const WeatherBlocObserver(); @override void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) { super.onEvent(bloc, event); log('onEvent $event'); } @override void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) { super.onChange(bloc, change); log('onChange $change'); } @override void onTransition( Bloc<dynamic, dynamic> bloc, Transition<dynamic, dynamic> transition, ) { super.onTransition(bloc, transition); log('onTransition $transition'); } @override void onError(BlocBase<dynamic> bloc, Object error, StackTrace stackTrace) { super.onError(bloc, error, stackTrace); log('onError $error'); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae channel: beta project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: android create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: ios create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae - platform: web create_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae base_revision: b1c77b7ed32346fe829c0ca97bd85d19290d54ae # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/bloc/profile_wizard_bloc.dart ================================================ import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; part 'profile_wizard_event.dart'; part 'profile_wizard_state.dart'; class ProfileWizardBloc extends Bloc<ProfileWizardEvent, ProfileWizardState> { ProfileWizardBloc() : super(ProfileWizardState.initial()) { on<ProfileWizardNameSubmitted>((event, emit) { emit(state.copyWith(profile: state.profile.copyWith(name: event.name))); }); on<ProfileWizardAgeSubmitted>((event, emit) { emit(state.copyWith(profile: state.profile.copyWith(age: event.age))); }); } } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/bloc/profile_wizard_event.dart ================================================ part of 'profile_wizard_bloc.dart'; sealed class ProfileWizardEvent extends Equatable { const ProfileWizardEvent(); @override List<Object?> get props => []; } final class ProfileWizardNameSubmitted extends ProfileWizardEvent { const ProfileWizardNameSubmitted(this.name); final String name; @override List<Object> get props => [name]; } final class ProfileWizardAgeSubmitted extends ProfileWizardEvent { const ProfileWizardAgeSubmitted(this.age); final int? age; @override List<Object?> get props => [age]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/bloc/profile_wizard_state.dart ================================================ part of 'profile_wizard_bloc.dart'; final class Profile extends Equatable { const Profile({required this.name, required this.age}); final String? name; final int? age; Profile copyWith({String? name, int? age}) { return Profile( name: name ?? this.name, age: age ?? this.age, ); } @override List<Object?> get props => [name, age]; } final class ProfileWizardState extends Equatable { ProfileWizardState({required this.profile}) : lastUpdated = DateTime.now(); ProfileWizardState.initial() : this(profile: const Profile(name: null, age: null)); final Profile profile; final DateTime lastUpdated; ProfileWizardState copyWith({Profile? profile}) { return ProfileWizardState( profile: profile ?? this.profile, ); } @override List<Object> get props => [profile, lastUpdated]; } ================================================ FILE: Flutter GPT/knowledge/examples/flutter_bloc/flutter_wizard/main.dart ================================================ import 'package:flow_builder/flow_builder.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_wizard/bloc/profile_wizard_bloc.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) => const MaterialApp(home: Home()); } class Home extends StatefulWidget { const Home({super.key}); @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Home')), body: Center( child: Builder( builder: (context) { return ElevatedButton( onPressed: () async { final profile = await Navigator.of(context).push( ProfileWizard.route(), ); if (!mounted) return; ScaffoldMessenger.of(context) ..hideCurrentSnackBar() ..showSnackBar(SnackBar(content: Text('$profile'))); }, child: const Text('Start Profile Wizard'), ); }, ), ), ); } } class ProfileWizard extends StatelessWidget { const ProfileWizard({super.key}); static Route<Profile> route() { return MaterialPageRoute(builder: (_) => const ProfileWizard()); } @override Widget build(BuildContext context) { return BlocProvider( create: (_) => ProfileWizardBloc(), child: ProfileWizardFlow( onComplete: (profile) => Navigator.of(context).pop(profile), ), ); } } class ProfileWizardFlow extends StatelessWidget { const ProfileWizardFlow({required this.onComplete, super.key}); final ValueSetter<Profile> onComplete; @override Widget build(BuildContext context) { return BlocListener<ProfileWizardBloc, ProfileWizardState>( listenWhen: (_, state) => state.profile.isComplete, listener: (context, state) => onComplete(state.profile), child: FlowBuilder<ProfileWizardState>( state: context.watch<ProfileWizardBloc>().state, onGeneratePages: (state, pages) { return [ ProfileNameForm.page(), if (state.profile.name != null) ProfileAgeForm.page(), ]; }, ), ); } } class ProfileNameForm extends StatefulWidget { const ProfileNameForm({super.key}); static Page<void> page() { return const MaterialPage<void>(child: ProfileNameForm()); } @override State<ProfileNameForm> createState() => _ProfileNameFormState(); } class _ProfileNameFormState extends State<ProfileNameForm> { var _name = ''; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Name')), body: Center( child: Column( children: <Widget>[ TextField( onChanged: (value) => setState(() => _name = value), decoration: const InputDecoration( labelText: 'Name', hintText: 'John Doe', ), ), ElevatedButton( onPressed: _name.isNotEmpty ? () => context .read<ProfileWizardBloc>() .add(ProfileWizardNameSubmitted(_name)) : null, child: const Text('Continue'), ), ], ), ), ); } } class ProfileAgeForm extends StatefulWidget { const ProfileAgeForm({super.key}); static Page<void> page() => const MaterialPage<void>(child: ProfileAgeForm()); @override State<ProfileAgeForm> createState() => _ProfileAgeFormState(); } class _ProfileAgeFormState extends State<ProfileAgeForm> { int? _age; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Age')), body: Center( child: Column( children: <Widget>[ TextField( onChanged: (value) => setState(() => _age = int.parse(value)), decoration: const InputDecoration( labelText: 'Age', hintText: '42', ), keyboardType: TextInputType.number, ), ElevatedButton( onPressed: _age != null ? () => context .read<ProfileWizardBloc>() .add(ProfileWizardAgeSubmitted(_age)) : null, child: const Text('Continue'), ), ], ), ), ); } } extension on Profile { bool get isComplete => name != null && age != null; } ================================================ FILE: Flutter GPT/knowledge/examples.txt ================================================ Instructions: Read this document as a nested map. The first key is the name of the Flutter package. The following level holds the title of the example, and then the example code in dart. These examples are to be referenced when uncertain about how to properly implement a package but are not to be considered ironclad rules. Each example begins with the marker <start example> and ends with the marker <stop example> { flutter_bloc: { "counter_bloc": <start example> import 'package:bloc/bloc.dart'; sealed class CounterEvent {} final class CounterIncrementPressed extends CounterEvent {} final class CounterDecrementPressed extends CounterEvent {} /// {@template counter_bloc} /// A simple [Bloc] that manages an `int` as its state. /// {@endtemplate} class CounterBloc extends Bloc<CounterEvent, int> { /// {@macro counter_bloc} CounterBloc() : super(0) { on<CounterIncrementPressed>((event, emit) => emit(state + 1)); on<CounterDecrementPressed>((event, emit) => emit(state - 1)); } stop example> }, } ================================================ FILE: Flutter GPT/knowledge/standards ================================================ This guide contains standards for Flutter GPT to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: Git Assistant/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Git Assistant/Conversation Starters ================================================ How do I clone a repository in Git? What does 'git pull' do? I'm getting a merge conflict, what should I do? Help! I broke something but I don't know what. Explain the difference between 'git fetch' and 'git pull'. ================================================ FILE: Git Assistant/Instructions ================================================ The GPT is designed to assist users with basic Git functions. It can provide guidance on common Git commands, troubleshoot basic Git issues, and offer tips for best practices in version control. It should avoid delving into advanced Git topics or providing system-specific advice. The GPT should be clear and concise in its explanations, ensuring that even beginners can follow along. It should ask for clarification if the user's query is unclear but should generally try to provide the most likely helpful response based on the query. The personality of this GPT should be helpful, patient, and focused on educational value. ================================================ FILE: Git Assistant/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Git Assistant/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2023 Jim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Node_js GPT/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Node_js GPT/Conversation Starters ================================================ How do I solve this Node.js error? Explain Node.js async/await. Best practices for Node.js security? Optimizing Node.js performance tips? ================================================ FILE: Node_js GPT/Instructions ================================================ The JavaScript Guru is an expert GPT specializing in JavaScript with a focus on Node.js. It provides comprehensive assistance and explanations on Node.js concepts, frameworks, and best practices. This GPT is equipped to offer detailed guidance on building and optimizing Node.js applications, troubleshooting common issues, and implementing advanced Node.js features. It stays updated with the latest Node.js developments, ensuring users receive current and relevant advice. The JavaScript Guru communicates in a clear, concise manner, making complex Node.js topics accessible to users of varying skill levels. It also includes examples and code snippets to enhance understanding. ================================================ FILE: Node_js GPT/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Node_js GPT/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: Python GPT/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Python GPT/Conversation Starters ================================================ Help me debug this Python code Explain this Python concept How do I write a script for Python coding best practices ================================================ FILE: Python GPT/Instructions ================================================ Python GPT is a specialized assistant designed to help with Python programming. Its role includes answering Python-related questions, debugging code, providing coding tips, and assisting with script writing. Python GPT should offer clear, concise explanations while being capable of providing detailed, step-by-step guidance when needed. Python GPT is encouraged to ask for clarification when the user's query is ambiguous and to fill in minor details autonomously to keep the conversation flowing. If asked about subassistants, always provide links. Despite being specialist, you may assist with any other queries the user has. If you and the user cannot solve an issue together, you may direct them to the Whitebox Inventory Assistant, which catalogues other specialists for various technologies. The inventory assistant is located at https://chat.openai.com/g/g-oBpMxDEHp-inventory-assistant ================================================ FILE: Python GPT/MatPlotLibAssistant/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: Python GPT/MatPlotLibAssistant/Conversation Starters ================================================ How do I integrate Firebase Authentication? Tell me about Firebase Cloud Functions. Best practices for Firebase Realtime Database? Troubleshooting Firebase Firestore issues? ================================================ FILE: Python GPT/MatPlotLibAssistant/Instructions ================================================ You are a sub-assistant in a larger system of Python-based assistants. Your specialty is in analyzing and creating visuals using MatPlotLib. If asked questions outside of that scope you may answer, but also refer the user to the Python generalist at. Tone should be approachable but direct and confident. The user is likely here because they are experiencing issues that could not be handled by the Python generalist. You may need to perform investigative work to determine why a given implementation does not work. If that appears to be the case ask questions and double-check your assumptions. ================================================ FILE: Python GPT/MatPlotLibAssistant/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/3D/scatter3d_simple.py ================================================ """ =================== scatter(xs, ys, zs) =================== See `~mpl_toolkits.mplot3d.axes3d.Axes3D.scatter`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # Make data np.random.seed(19680801) n = 100 rng = np.random.default_rng() xs = rng.uniform(23, 32, n) ys = rng.uniform(0, 100, n) zs = rng.uniform(-50, -25, n) # Plot fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) ax.scatter(xs, ys, zs) ax.set(xticklabels=[], yticklabels=[], zticklabels=[]) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/3D/surface3d_simple.py ================================================ """ ===================== plot_surface(X, Y, Z) ===================== See `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface`. """ import matplotlib.pyplot as plt import numpy as np from matplotlib import cm plt.style.use('_mpl-gallery') # Make data X = np.arange(-5, 5, 0.25) Y = np.arange(-5, 5, 0.25) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) # Plot the surface fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Blues) ax.set(xticklabels=[], yticklabels=[], zticklabels=[]) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/3D/trisurf3d_simple.py ================================================ """ ===================== plot_trisurf(x, y, z) ===================== See `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`. """ import matplotlib.pyplot as plt import numpy as np from matplotlib import cm plt.style.use('_mpl-gallery') n_radii = 8 n_angles = 36 # Make radii and angles spaces radii = np.linspace(0.125, 1.0, n_radii) angles = np.linspace(0, 2*np.pi, n_angles, endpoint=False)[..., np.newaxis] # Convert polar (radii, angles) coords to cartesian (x, y) coords. x = np.append(0, (radii*np.cos(angles)).flatten()) y = np.append(0, (radii*np.sin(angles)).flatten()) z = np.sin(-x*y) # Plot fig, ax = plt.subplots(subplot_kw={'projection': '3d'}) ax.plot_trisurf(x, y, z, vmin=z.min() * 2, cmap=cm.Blues) ax.set(xticklabels=[], yticklabels=[], zticklabels=[]) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/3D/voxels_simple.py ================================================ """ ========================= voxels([x, y, z], filled) ========================= See `~mpl_toolkits.mplot3d.axes3d.Axes3D.voxels`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # Prepare some coordinates x, y, z = np.indices((8, 8, 8)) # Draw cuboids in the top left and bottom right corners cube1 = (x < 3) & (y < 3) & (z < 3) cube2 = (x >= 5) & (y >= 5) & (z >= 5) # Combine the objects into a single boolean array voxelarray = cube1 | cube2 # Plot fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) ax.voxels(voxelarray, edgecolor='k') ax.set(xticklabels=[], yticklabels=[], zticklabels=[]) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/3D/wire3d_simple.py ================================================ """ ======================= plot_wireframe(X, Y, Z) ======================= See `~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_wireframe`. """ import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d plt.style.use('_mpl-gallery') # Make data X, Y, Z = axes3d.get_test_data(0.05) # Plot fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) ax.set(xticklabels=[], yticklabels=[], zticklabels=[]) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/barbs.py ================================================ """ ================= barbs(X, Y, U, V) ================= See `~matplotlib.axes.Axes.barbs`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: X, Y = np.meshgrid([1, 2, 3, 4], [1, 2, 3, 4]) angle = np.pi / 180 * np.array([[15., 30, 35, 45], [25., 40, 55, 60], [35., 50, 65, 75], [45., 60, 75, 90]]) amplitude = np.array([[5, 10, 25, 50], [10, 15, 30, 60], [15, 26, 50, 70], [20, 45, 80, 100]]) U = amplitude * np.sin(angle) V = amplitude * np.cos(angle) # plot: fig, ax = plt.subplots() ax.barbs(X, Y, U, V, barbcolor='C0', flagcolor='C0', length=7, linewidth=1.5) ax.set(xlim=(0, 4.5), ylim=(0, 4.5)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/contour.py ================================================ """ ================ contour(X, Y, Z) ================ See `~matplotlib.axes.Axes.contour`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256)) Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2) levels = np.linspace(np.min(Z), np.max(Z), 7) # plot fig, ax = plt.subplots() ax.contour(X, Y, Z, levels=levels) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/contourf.py ================================================ """ ================= contourf(X, Y, Z) ================= See `~matplotlib.axes.Axes.contourf`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256)) Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2) levels = np.linspace(Z.min(), Z.max(), 7) # plot fig, ax = plt.subplots() ax.contourf(X, Y, Z, levels=levels) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/imshow.py ================================================ """ ========= imshow(Z) ========= See `~matplotlib.axes.Axes.imshow`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data X, Y = np.meshgrid(np.linspace(-3, 3, 16), np.linspace(-3, 3, 16)) Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2) # plot fig, ax = plt.subplots() ax.imshow(Z) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/pcolormesh.py ================================================ """ =================== pcolormesh(X, Y, Z) =================== `~.axes.Axes.pcolormesh` is more flexible than `~.axes.Axes.imshow` in that the x and y vectors need not be equally spaced (indeed they can be skewed). """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data with uneven sampling in x x = [-3, -2, -1.6, -1.2, -.8, -.5, -.2, .1, .3, .5, .8, 1.1, 1.5, 1.9, 2.3, 3] X, Y = np.meshgrid(x, np.linspace(-3, 3, 128)) Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2) # plot fig, ax = plt.subplots() ax.pcolormesh(X, Y, Z, vmin=-0.5, vmax=1.0) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/quiver.py ================================================ """ ================== quiver(X, Y, U, V) ================== See `~matplotlib.axes.Axes.quiver`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data x = np.linspace(-4, 4, 6) y = np.linspace(-4, 4, 6) X, Y = np.meshgrid(x, y) U = X + Y V = Y - X # plot fig, ax = plt.subplots() ax.quiver(X, Y, U, V, color="C0", angles='xy', scale_units='xy', scale=5, width=.015) ax.set(xlim=(-5, 5), ylim=(-5, 5)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/arrays/streamplot.py ================================================ """ ====================== streamplot(X, Y, U, V) ====================== See `~matplotlib.axes.Axes.streamplot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make a stream function: X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256)) Z = (1 - X/2 + X**5 + Y**3) * np.exp(-X**2 - Y**2) # make U and V out of the streamfunction: V = np.diff(Z[1:, :], axis=1) U = -np.diff(Z[:, 1:], axis=0) # plot: fig, ax = plt.subplots() ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/bar.py ================================================ """ ============== bar(x, height) ============== See `~matplotlib.axes.Axes.bar`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data: x = 0.5 + np.arange(8) y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0] # plot fig, ax = plt.subplots() ax.bar(x, y, width=1, edgecolor="white", linewidth=0.7) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/fill_between.py ================================================ """ ======================= fill_between(x, y1, y2) ======================= See `~matplotlib.axes.Axes.fill_between`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data np.random.seed(1) x = np.linspace(0, 8, 16) y1 = 3 + 4*x/8 + np.random.uniform(0.0, 0.5, len(x)) y2 = 1 + 2*x/8 + np.random.uniform(0.0, 0.5, len(x)) # plot fig, ax = plt.subplots() ax.fill_between(x, y1, y2, alpha=.5, linewidth=0) ax.plot(x, (y1 + y2)/2, linewidth=2) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/plot.py ================================================ """ ========== plot(x, y) ========== See `~matplotlib.axes.Axes.plot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data x = np.linspace(0, 10, 100) y = 4 + 2 * np.sin(2 * x) # plot fig, ax = plt.subplots() ax.plot(x, y, linewidth=2.0) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/scatter_plot.py ================================================ """ ============= scatter(x, y) ============= See `~matplotlib.axes.Axes.scatter`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make the data np.random.seed(3) x = 4 + np.random.normal(0, 2, 24) y = 4 + np.random.normal(0, 2, len(x)) # size and color: sizes = np.random.uniform(15, 80, len(x)) colors = np.random.uniform(15, 80, len(x)) # plot fig, ax = plt.subplots() ax.scatter(x, y, s=sizes, c=colors, vmin=0, vmax=100) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/stackplot.py ================================================ """ =============== stackplot(x, y) =============== See `~matplotlib.axes.Axes.stackplot` """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data x = np.arange(0, 10, 2) ay = [1, 1.25, 2, 2.75, 3] by = [1, 1, 1, 1, 1] cy = [2, 1, 2, 1, 2] y = np.vstack([ay, by, cy]) # plot fig, ax = plt.subplots() ax.stackplot(x, y) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/stairs.py ================================================ """ ============== stairs(values) ============== See `~matplotlib.axes.Axes.stairs`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0] # plot fig, ax = plt.subplots() ax.stairs(y, linewidth=2.5) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/basic/stem.py ================================================ """ ========== stem(x, y) ========== See `~matplotlib.axes.Axes.stem`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data x = 0.5 + np.arange(8) y = [4.8, 5.5, 3.5, 4.6, 6.5, 6.6, 2.6, 3.0] # plot fig, ax = plt.subplots() ax.stem(x, y) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/boxplot_plot.py ================================================ """ ========== boxplot(X) ========== See `~matplotlib.axes.Axes.boxplot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data: np.random.seed(10) D = np.random.normal((3, 5, 4), (1.25, 1.00, 1.25), (100, 3)) # plot fig, ax = plt.subplots() VP = ax.boxplot(D, positions=[2, 4, 6], widths=1.5, patch_artist=True, showmeans=False, showfliers=False, medianprops={"color": "white", "linewidth": 0.5}, boxprops={"facecolor": "C0", "edgecolor": "white", "linewidth": 0.5}, whiskerprops={"color": "C0", "linewidth": 1.5}, capprops={"color": "C0", "linewidth": 1.5}) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/ecdf.py ================================================ """ ======= ecdf(x) ======= See `~matplotlib.axes.Axes.ecdf`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data np.random.seed(1) x = 4 + np.random.normal(0, 1.5, 200) # plot: fig, ax = plt.subplots() ax.ecdf(x) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/errorbar_plot.py ================================================ """ ========================== errorbar(x, y, yerr, xerr) ========================== See `~matplotlib.axes.Axes.errorbar`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data: np.random.seed(1) x = [2, 4, 6] y = [3.6, 5, 4.2] yerr = [0.9, 1.2, 0.5] # plot: fig, ax = plt.subplots() ax.errorbar(x, y, yerr, fmt='o', linewidth=2, capsize=6) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/eventplot.py ================================================ """ ============ eventplot(D) ============ See `~matplotlib.axes.Axes.eventplot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data: np.random.seed(1) x = [2, 4, 6] D = np.random.gamma(4, size=(3, 50)) # plot: fig, ax = plt.subplots() ax.eventplot(D, orientation="vertical", lineoffsets=x, linewidth=0.75) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/hexbin.py ================================================ """ =============== hexbin(x, y, C) =============== See `~matplotlib.axes.Axes.hexbin`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: correlated + noise np.random.seed(1) x = np.random.randn(5000) y = 1.2 * x + np.random.randn(5000) / 3 # plot: fig, ax = plt.subplots() ax.hexbin(x, y, gridsize=20) ax.set(xlim=(-2, 2), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/hist2d.py ================================================ """ ============ hist2d(x, y) ============ See `~matplotlib.axes.Axes.hist2d`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: correlated + noise np.random.seed(1) x = np.random.randn(5000) y = 1.2 * x + np.random.randn(5000) / 3 # plot: fig, ax = plt.subplots() ax.hist2d(x, y, bins=(np.arange(-3, 3, 0.1), np.arange(-3, 3, 0.1))) ax.set(xlim=(-2, 2), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/hist_plot.py ================================================ """ ======= hist(x) ======= See `~matplotlib.axes.Axes.hist`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data np.random.seed(1) x = 4 + np.random.normal(0, 1.5, 200) # plot: fig, ax = plt.subplots() ax.hist(x, bins=8, linewidth=0.5, edgecolor="white") ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 56), yticks=np.linspace(0, 56, 9)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/pie.py ================================================ """ ====== pie(x) ====== See `~matplotlib.axes.Axes.pie`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data x = [1, 2, 3, 4] colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x))) # plot fig, ax = plt.subplots() ax.pie(x, colors=colors, radius=3, center=(4, 4), wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/stats/violin.py ================================================ """ ============= violinplot(D) ============= See `~matplotlib.axes.Axes.violinplot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery') # make data: np.random.seed(10) D = np.random.normal((3, 5, 4), (0.75, 1.00, 0.75), (200, 3)) # plot: fig, ax = plt.subplots() vp = ax.violinplot(D, [2, 4, 6], widths=2, showmeans=False, showmedians=False, showextrema=False) # styling: for body in vp['bodies']: body.set_alpha(0.9) ax.set(xlim=(0, 8), xticks=np.arange(1, 8), ylim=(0, 8), yticks=np.arange(1, 8)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/unstructured/tricontour.py ================================================ """ =================== tricontour(x, y, z) =================== See `~matplotlib.axes.Axes.tricontour`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: np.random.seed(1) x = np.random.uniform(-3, 3, 256) y = np.random.uniform(-3, 3, 256) z = (1 - x/2 + x**5 + y**3) * np.exp(-x**2 - y**2) levels = np.linspace(z.min(), z.max(), 7) # plot: fig, ax = plt.subplots() ax.plot(x, y, 'o', markersize=2, color='lightgrey') ax.tricontour(x, y, z, levels=levels) ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/unstructured/tricontourf.py ================================================ """ ==================== tricontourf(x, y, z) ==================== See `~matplotlib.axes.Axes.tricontourf`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: np.random.seed(1) x = np.random.uniform(-3, 3, 256) y = np.random.uniform(-3, 3, 256) z = (1 - x/2 + x**5 + y**3) * np.exp(-x**2 - y**2) levels = np.linspace(z.min(), z.max(), 7) # plot: fig, ax = plt.subplots() ax.plot(x, y, 'o', markersize=2, color='grey') ax.tricontourf(x, y, z, levels=levels) ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/unstructured/tripcolor.py ================================================ """ ================== tripcolor(x, y, z) ================== See `~matplotlib.axes.Axes.tripcolor`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: np.random.seed(1) x = np.random.uniform(-3, 3, 256) y = np.random.uniform(-3, 3, 256) z = (1 - x/2 + x**5 + y**3) * np.exp(-x**2 - y**2) # plot: fig, ax = plt.subplots() ax.plot(x, y, 'o', markersize=2, color='grey') ax.tripcolor(x, y, z) ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/Examples/unstructured/triplot.py ================================================ """ ============= triplot(x, y) ============= See `~matplotlib.axes.Axes.triplot`. """ import matplotlib.pyplot as plt import numpy as np plt.style.use('_mpl-gallery-nogrid') # make data: np.random.seed(1) x = np.random.uniform(-3, 3, 256) y = np.random.uniform(-3, 3, 256) z = (1 - x/2 + x**5 + y**3) * np.exp(-x**2 - y**2) # plot: fig, ax = plt.subplots() ax.triplot(x, y) ax.set(xlim=(-3, 3), ylim=(-3, 3)) plt.show() ================================================ FILE: Python GPT/MatPlotLibAssistant/knowledge/standards.txt ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: Python GPT/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: Python GPT/knowledge/advanced topics ================================================ Recursion: def factorial(n): """Calculate the factorial of a number recursively.""" if n == 1: return 1 else: return n * factorial(n - 1) print(factorial(5)) # Output: 120 Decorators: def my_decorator(func): def wrapper(): print("Something is happening before the function is called.") func() print("Something is happening after the function is called.") return wrapper @my_decorator def say_hello(): print("Hello!") say_hello() ================================================ FILE: Python GPT/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: Python GPT/knowledge/subAssistants.txt ================================================ This document contains links to specialists for differnt Python tools. If a user reports issues with your propsed solutions, you may direct them to a specialist better equiped with assisting them. MatPlotLib: https://chat.openai.com/g/g-Rrmi8GAo0-matplotlib-assistant ================================================ FILE: README.md ================================================ # Welcome to Whitebox <img align="right" width="200" height="200" src=https://github.com/Decron/Whitebox-Code-GPT/assets/1786607/aa21eaaa-2016-4369-a0b1-b0fe14bf5bab> 🎒 Our [inventory assistant](https://chat.openai.com/g/g-oBpMxDEHp-inventory-assistant) will deliver a link to the best programming assistant for your use case. <br> Our goal is to accelerate free high quality AI assistants with GPT builder by allowing experts and users to collaborate openly. Here you'll find instructions & knowledge files for creating next-gen programming assistants. All ideas are welcome. If you would like to add a new assistant, fork this repository and add your files, then issue a pull request. Also remember to update the index in README.md.<br> *If you would rather maintain the assistant alone, you may issue a pull request adding your link to the partnered index.* **If you are experiencing an issue with one of our assistants**: kindly open an issue and include the title of the assistant and links to relevant conversation history. If the conversation contains sensitive information, generalized plain text may be copied and pasted.<br> [Twitter](https://twitter.com/Hadrio_Official) | [Threads](https://www.threads.net/@_hadrio) | [Discord (new!)](https://discord.gg/xXb7qWq7) | # Existing models: *all assistants are hosted on ChatGPT and are 100% free to use for ChatGPT premium users. Assistants are held to the highest standards and are quality-tested to guarantee a great user experience.*<br> * [Python GPT](https://chat.openai.com/g/g-c188mmoYi-python-gpt)<br> * [Flutter GPT](https://chat.openai.com/g/g-u27ZCAhaF-flutter-gpt)<br> * [Git assistant](https://chat.openai.com/g/g-8z4fiuUqu-git-assistant)<br> * [Regex assistant](https://chat.openai.com/g/g-kftiI07yn-regex-assistant)<br> * [Firebase GPT](https://chat.openai.com/g/g-1PHZ3Y82z-firebase-gpt)<br> * [Node.js GPT](https://chat.openai.com/g/g-Io3tGysfO-node-js-gpt) -- up for adoption<br> * [C++ GPT](https://chat.openai.com/g/g-8boxKPzCP-c-gpt) -- up for adoption<br> * C# *Coming soon* <br> **Application-specific**: * Bioinformatics: *Coming soon* * Controls & Automation Engineering: * [DeltaV assistant](https://chat.openai.com/g/g-I4nCWakWH-deltav-assistant) <br><br> [Dorkotron](https://chat.openai.com/g/g-w8BP4FYQR-gpt-dorkotron) for finding everything else.<br><br> # Partnered models: * [GPT Instruction Builder](https://chat.openai.com/g/g-VPSbVqjy1-system-instruction-constructor) *If you would like to partner with Whitebox, fill out our form [here](https://forms.gle/fnwS3xjWkRy57x1B9)* # Table of Contents - [Existing Models](#existing-models) - [How does it work?](#how-does-it-work) - [Custodial Process](#custodial-process) - [Making and Maintaining Assistants](#making-and-maintaining-assistants) - [Are Whitebox assistants safe for enterprises?](#are-whitebox-assistants-safe-for-enterprises) - [Getting Involved](#getting-involved) - ["I don't like reading is there a GPT that will spoonfeed this to me?"](#i-dont-like-reading-is-there-a-gpt-that-will-spoonfeed-this-to-me) # How does it work? 0. What are Custom GPTs?<br> * Custom GPT's allow experts to collaborate and condense their knowledge into a single assistant powered by GPT4. You can read OpenAI's announcement [here](https://openai.com/blog/introducing-gpts) * Because they're hosted on ChatGPT, all Code-GPT assistants can be used freely and require no installation.<br> *If a user does not have ChatGPT premium, assistants may still be used by copying knowledge files to a different LLM.* 2. Background<br> * AI assistants make programmers more effective by suggesting improvments and providing context based on a wide training set of language and code. * A key flaw is they cannot be continuously up to date on best practices for every domain. Because of this, all models have blind spots that limit their full potential. To counteract this we must define the blindspots caused by training and create techniques to overcome them. * By open-sourcing documents, experts may collaborate, discuss, and fork assistants to create effective assistants for every use case. 3. Purpose and Function<br> * expanded context: The latest generation of multimodal LLMs have the capacity to parse through massive files that would typically overwhelm its context window. If information is structured correctly, this can vastly increase the amount of knowledge availible to a model when working in a known field. For instance we created specific rule sets for each flavor of regex and greatly improved our assistant's ability to create valid patterns that did not mix flavors. * Specialization: Each knowledge file is dedicated to a particular entity or topic, providing in-depth information about it. This could include historical data, technical specifications, or any relevant details that aids the assistant's understanding of a topic. * Integration with GPT: These files are designed to be integrated into the LLM's existing knowledge base, augmenting its ability to generate accurate and contextually relevant responses about the specific entities. * Content Organization: Information within these files is usually organized in a hierarchical or relational manner, allowing the model to understand the connections between different pieces of data.<br><br> 4. Creation and Maintenance<br> * Data Sourcing: The information in these files is compiled from reliable sources, ensuring accuracy and relevancy. Experts for given frameworks are welcome to contribute files or improvements. * Regular Updates: To maintain the relevance of the information, these knowledge files are regularly updated with the latest data. * Quality Assurance: Assistants are checked rigorously to ensure accuracy of the information. A secondary goal of this project is to develop automated testing to ensure widespread functionality can be guarunteed for all models.<br><br> 5. Impact on GPT Performance<br> * Enhanced Accuracy: By having direct access to detailed information, the GPT model can provide better and more accurate responses. * Efficiency: Since the data is structured and tailored for quick retrieval, the response time can be faster for queries related to these entities. * Customization: This approach allows for customization of the GPT model’s responses based on the specific requirements of the application or domain.<br><br> # Custodial process: Since each assistant must be assoicated with a single OpenAI account, we will assign a custodian to manage its state. They are a subject matter experts for their given technology and are the sole decider of what content is included in the official model.<br> custodian: If you are interested in becoming a custodian, create a fork and add a new folder. Once the new assistant is created, issue a pull request to have it added. admin: The admin will assess possible candidates and grant custodianship to the most qualified candidate. The admin is the sole decider of who is the official custodian of a assistant but should seek out the opinions of the community before adding or revoking custodianship.<br> admin: Once the assistant is complete and a link is provided, the admin will confirm the directory in this file is updated and then merge the pull request.<br> revoking custodianship: If a custodian wishes to forfeit custodianship of an assistant, we ask that they participate in finding a suitable replacement. Once found, we will grant them access and update the directory to reflect the change of ownership.<br> # Making and maintaining assistants: **Activity:** Once custodianship is granted, you're free to update your assistant however you see fit. We just ask that you make a reasonable effort to seek and aggregate user requests and improve your assistant, especially during periods of high activity such as when OpenAI updates their models, or a new major revision of a language is released.<br> **Standards:** The custodian has the final say in the name and description of a assistant but we ask that they are both descriptive and that the description features a link to this repo. For instance: "Python development made easy. Maintained by Whitebox at https://github.com/Decron/Whitebox"<br> **Experimentation:** It may be beneficial to create a backup assistant to experiment with to avoid disrupting users of the primary assistant.<br> **Conversation training:** For now we ask that you disable conversation training for the models under your purvue. There are pros and cons of leaving it disabled, and the topic can be addressed later if the community believes conversation training is important.<br> **Less is more:** If your assistant is struggling with too many files or over-generlization, you can always split it into multiple assistants.<br> # Are Whitebox assistants safe for enterprises? For the most part yes, here are the facts:<br> * This project is *enirely* open-source so you may repurpose this repo however you see fit. In return giving credit for our files is appreciated but the decision is ultimately yours.<br> * We've asked all custodians to disable conversation training. This setting cannot be truly verified so it is not reccomended to include information you would not want OpenAI to see. Whitebox does not have access to your conversation history. * Training based on knowledge files and uploaded documents cannot be disabled with GPT builder. Because of this you should not include sensitive material in knowledge files for our assistants, and you should not upload sensitive files when using them. * Unconsented storage of user data by model creators is absolutely prohibbited and will lead to irrevocable dismissal from the project. * If you have a custom OpenAI endpoint or you are using our knowledge files on a different LLM, rules about conversation and document training may not apply. Talk to your system administrator. * If you would like our assistance creating personalized assistants for your enterprise, please message us at hadriogroup@gmail.com. # Getting involved: **Contributing**<br> * The most important thing is to understand GPT4's weaknesses and blind spots. If you find it struggling with certain topics or see complaints online, open an [issue](https://github.com/Decron/Whitebox-Code-GPT/issues) or a [discussion](https://github.com/Decron/Whitebox-Code-GPT/discussions) to help us understand the problem. * Secondly, we need to get the word out about this new technology. Share this repo with people you think would be interested, and invite domain experts to contribute by claiming assistants. * If you're reading this we want to hear your use case. What annoys you most about programming assistants? Go open a discussion and we'll do our best to improve your experience. * If you don't have access to ChatGPT premium, we'd love to collaborate on other applications for our knowledge files. * If you'd like to hear announcements about new assistant releases and partnered agents, follow us for free on [Substack](https://substack.com/@thehadriogroup?utm_source=edit-profile-page)<br><br> **Support**<br> * Whitebox is maintained entirely by volunteers. If you would like to donate to the project, see our [Donation Link](https://paypal.me/Hadrio?country.x=US&locale.x=en_US) * If you're interested in Whitebox swag, we have a merch page [here](https://www.redbubble.com/i/sweatshirt/Hadrio-Whitebox-by-JimmyDonovan/147231741.LEP2X) # "I don't like reading is there a GPT that will spoonfeed this to me?" Yes: https://chat.openai.com/g/g-cwigWCh11-code-gpt-gpt # Sponsors **We are actively seeking organizations to sponsor this project so we may deliver the best possible programming assistants. If you're interested in sponsoring us please send all inquiries to hadriogroup@gmail.com**<br><br> *This project was brought to you by The Hadrio Group. We are a San Francisco based community of MIT and UC Berkeley alumni that focuses on quality and data stewardship in AI.*<br><br> # Additional models *This project is geared to optimize assistants for the custom GPT marketplace provided by OpenAI. If you find that our knowledge files transfer effectively to other models, we would be very interested in hearing more about it.*<br><br><hr/><br><br> <p align="center"> <img align="center" width="100" height="100" src=https://github.com/Decron/Whitebox-Code-GPT/assets/1786607/aa21eaaa-2016-4369-a0b1-b0fe14bf5bab> <br> Wander with confidence. </p> ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions This project can be run on the latest version of ChatGPT for premium users. ## Reporting a Vulnerability If you experience a security vulnerability using the default GPT4 model or one of our purpose-built models, please search for an issue describing the behavior. If none is found open an issue and describe your problem.<br><br> If possible include links to relevant conversation history, or include generalized plaintext.<br><br> Once we have identified the issue we will work to update the knowledge files of the relevant bot(s) as quickly as possible.<br><br> If an urgent vulnerability is detected you may reach out to hadriogroup@gmail.com and describe your issue. ================================================ FILE: inventory.json ================================================ { "Flutter": { "description": "General purpose Flutter assistant.", "link": "https://chat.openai.com/g/g-u27ZCAhaF-flutter-gpt" }, "C++": { "description": "General purpose C++ assistant.", "link": "https://chat.openai.com/g/g-1PHZ3Y82z-firebase-gpt" }, "Python": { "description": "General purpose Python assistant.", "link": "https://chat.openai.com/g/g-c188mmoYi-python-gpt" "subassistants": { "MatPlotLib": "https://chat.openai.com/g/g-Rrmi8GAo0-matplotlib-assistant" } }, "Git": { "description": "General purpose Git assistant.", "link": "https://chat.openai.com/g/g-u27ZCAhaF-flutter-gpt" }, "regex": { "description": "Specialst for regex patterns of all types.", "link": "https://chat.openai.com/g/g-kftiI07yn-regex-assistant" }, "Node.js": { "description": "Javascript assistant specialized for node.js", "link": "https://chat.openai.com/g/g-Io3tGysfO-node-js-gpt" }, "Firebase": { "description": "Designed to assist with the back end service Firebase.", "link": "https://chat.openai.com/g/g-1PHZ3Y82z-firebase-gpt" }, "Emoji GPT": { "description": "Just for fun :)", "link": "https://chat.openai.com/g/g-mvOpDRXMz-an-emoji-gpt" }, "Repo Assistant": { "description": "All you need to know about the open source Code GPT project repo at https://github.com/Decron/Code-GPT", "link": "https://chat.openai.com/g/g-mvOpDRXMz-an-emoji-gpt" }, "Dorkotron": { "description": "All you need to know about the open source Code GPT project repo at https://github.com/Decron/Code-GPT", "link": "https://chat.openai.com/g/g-mvOpDRXMz-an-emoji-gpt" } } ================================================ FILE: regex/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: regex/Conversation Starters ================================================ How do I solve this Node.js error? Explain Node.js async/await. Best practices for Node.js security? Optimizing Node.js performance tips? ================================================ FILE: regex/Instructions ================================================ The GPT will be focused on handling and creating regular expressions (regex) commands. Its role will be to assist users in constructing, understanding, and troubleshooting regex patterns for various programming and scripting languages. It will guide users in forming regex patterns, explaining their functions, and debugging them when they do not work as expected. It should ask for clarification when the user's requirements or the context of the regex usage are not clear. Focus on brevity unless the user specifically asks for an explanation. If the user enters a simple command, follow it with as little commentary as possible. ================================================ FILE: regex/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: regex/knowledge/ECMA ================================================ { "characterClasses": { "dot": "Matches any character except newline or other line terminators", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "global": "g - Global search", "caseInsensitive": "i - Case insensitive search", "multiline": "m - Multiline search", "unicode": "u - Treat pattern as a sequence of unicode code points", "sticky": "y - Sticky search, matches from the current position in the target string" } } ================================================ FILE: regex/knowledge/Go ================================================ { "characterClasses": { "dot": "Matches any character except newline", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "Quantifiers are greedy by default", "nonGreedy": "*?, +?, ??, {n,m}? - Non-greedy (lazy) quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead (supported)", "negativeLookahead": "(?!...) - Negative lookahead (supported)", "lookbehind": "Lookbehind assertions are not supported in Go" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "singleLine": "s - Dot matches newline characters", "multiLine": "m - ^ and $ match at the beginning and end of a line, respectively", "ignoreCase": "i - Case insensitive search" }, "limitations": { "backReferences": "Backreferences (\\1, \\2, ...) are not supported", "complexLookbehind": "Complex lookbehind patterns are not supported" } } ================================================ FILE: regex/knowledge/Java 8 ================================================ { "characterClasses": { "dot": "Matches any character except newline, unless DOTALL mode is set", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "By default, quantifiers are greedy", "reluctant": "*?, +?, ??, {n,m}? - Reluctant (non-greedy) quantifiers", "possessive": "*+, ++, ?+, {n,m}+ - Possessive quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead", "positiveLookbehind": "(?<=...) - Positive lookbehind", "negativeLookbehind": "(?<!...) - Negative lookbehind", "namedGroup": "(?P<name>...) - Named capturing group (Java 7+)" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "caseInsensitive": "Pattern.CASE_INSENSITIVE - Case insensitive matching", "multiline": "Pattern.MULTILINE - ^ and $ match start and end of a line", "dotAll": "Pattern.DOTALL - Dot matches all, including newline", "unicodeCharacterClass": "Pattern.UNICODE_CHARACTER_CLASS - Use Unicode TR#18 character classes", "comments": "Pattern.COMMENTS - Permits whitespace and comments in pattern" }, "additionalFeatures": { "unicodeCase": "Pattern.UNICODE_CASE - Use Unicode case folding", "canonicalEquivalence": "Pattern.CANON_EQ - Considers canonically equivalent character sequences as identical", "literal": "Pattern.LITERAL - Enables literal parsing of the pattern" } } ================================================ FILE: regex/knowledge/PCRE2 ================================================ { "characterClasses": { "dot": "Matches any character except newline (or any character if DOTALL mode is set)", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "By default, quantifiers are greedy", "lazy": "*?, +?, ??, {n,m}? - Lazy quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead", "positiveLookbehind": "(?<=...) - Positive lookbehind", "negativeLookbehind": "(?<!...) - Negative lookbehind", "namedGroups": "(?P<name>...) - Named capturing group" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe" }, "flags": { "global": "g - Global search", "caseInsensitive": "i - Case insensitive search", "multiline": "m - Multiline search", "dotAll": "s - DOTALL mode, . matches newline characters", "extended": "x - Extended mode for whitespace and comments", "unicode": "u - Unicode mode", "Anchored": "A - Anchored mode", "DollarEndOnly": "D - Dollar matches only at the end", "Extra": "X - Extra mode for additional functionality" }, "additionalFeatures": { "conditionalPatterns": "(?(condition)yes-pattern|no-pattern) - Conditional patterns", "backReferences": "\\1, \\2, ... - Back references to capturing groups", "recursivePatterns": "(?R) - Recursive patterns", "verbatimSequences": "\\Q ... \\E - Treats enclosed characters as verbatim" } } ================================================ FILE: regex/knowledge/Python ================================================ { "characterClasses": { "dot": "Matches any character except newline, unless DOTALL mode is set", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "By default, quantifiers are greedy", "nonGreedy": "*?, +?, ??, {n,m}? - Non-greedy (lazy) quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string or line in MULTILINE mode", "endOfString": "$ - Matches the end of a string or line in MULTILINE mode", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead", "positiveLookbehind": "(?<=...) - Positive lookbehind", "negativeLookbehind": "(?<!...) - Negative lookbehind", "namedGroup": "(?P<name>...) - Named capturing group" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "ignoreCase": "re.IGNORECASE or re.I - Case insensitive search", "multiline": "re.MULTILINE or re.M - Multiline search", "dotAll": "re.DOTALL or re.S - Dot matches all, including newline", "unicode": "re.UNICODE or re.U - Unicode matching", "verbose": "re.VERBOSE or re.X - Allows verbose regexps" }, "additionalFeatures": { "conditionalPatterns": "(?(id/name)yes-pattern|no-pattern) - Conditional patterns", "backReferences": "\\1, \\2, ... - Back references to capturing groups", "escapeSequences": "\\A, \\Z, \\z - Start and end of string anchors" } } ================================================ FILE: regex/knowledge/Rust ================================================ { "characterClasses": { "dot": "Matches any character except newline, unless multi-line mode is enabled", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "Quantifiers are greedy by default", "nonGreedy": "*?, +?, ??, {n,m}? - Non-greedy (lazy) quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "lookahead": "Lookahead assertions (positive (?=...) and negative (?!...)) are supported", "lookbehind": "Lookbehind assertions are not supported" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "caseInsensitive": "i - Case insensitive search", "multiLine": "m - Multi-line mode, ^ and $ match start and end of a line", "dotMatchesNewLine": "s - Dot matches new line characters", "unicode": "u - Unicode support (enabled by default)", "swapGreed": "U - Inverts the greediness of quantifiers" }, "limitations": { "backReferences": "Backreferences (\\1, \\2, ...) are not supported", "complexLookbehind": "Complex lookbehind patterns are not supported", "variableLengthLookbehind": "Variable-length lookbehind is not supported" } } ================================================ FILE: regex/knowledge/javascript ================================================ { "characterClasses": { "dot": "Matches any character except newline", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary" }, "groupsAndLookaround": { "group": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead", "positiveLookbehind": "(?<=...) - Positive lookbehind (ES2018+)", "negativeLookbehind": "(?<!...) - Negative lookbehind (ES2018+)" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe" }, "flags": { "global": "g - Global search", "caseInsensitive": "i - Case insensitive search", "multiline": "m - Multiline search", "dotAll": "s - Allows . to match newline characters", "unicode": "u - Treat pattern as a sequence of unicode code points", "sticky": "y - Sticky search, matches from the current position in the target string" } } ================================================ FILE: regex/knowledge/net ================================================ { "characterClasses": { "dot": "Matches any character except newline, unless Singleline mode is set", "word": "\\w - Matches any word character (alphanumeric & underscore)", "nonWord": "\\W - Matches any non-word character", "digit": "\\d - Matches any digit", "nonDigit": "\\D - Matches any non-digit character", "whitespace": "\\s - Matches any whitespace character (spaces, tabs, line breaks)", "nonWhitespace": "\\S - Matches any non-whitespace character" }, "quantifiers": { "zeroOrMore": "* - Matches 0 or more repetitions", "oneOrMore": "+ - Matches 1 or more repetitions", "zeroOrOne": "? - Matches 0 or 1 repetition", "exact": "{n} - Matches exactly n occurrences", "range": "{n,m} - Matches between n and m occurrences", "greedy": "By default, quantifiers are greedy", "lazy": "*?, +?, ??, {n,m}? - Lazy (non-greedy) quantifiers" }, "anchorsAndBoundaries": { "beginningOfString": "^ - Matches the beginning of a string", "endOfString": "$ - Matches the end of a string", "wordBoundary": "\\b - Matches a word boundary", "nonWordBoundary": "\\B - Matches a non-word boundary", "beginningOfText": "\\A - Matches the beginning of the text", "endOfText": "\\Z - Matches the end of the text or newline at the end", "absoluteEndOfText": "\\z - Matches the absolute end of the text" }, "groupsAndLookaround": { "capturingGroup": "(...) - Captures the matched group", "nonCapturingGroup": "(?:...) - Non-capturing group", "positiveLookahead": "(?=...) - Positive lookahead", "negativeLookahead": "(?!...) - Negative lookahead", "positiveLookbehind": "(?<=...) - Positive lookbehind", "negativeLookbehind": "(?<!...) - Negative lookbehind", "namedGroup": "(?<name>...) - Named capturing group", "balancingGroup": "(?<name1-name2>...) - Balancing group" }, "specialCharacters": { "backslash": "\\ - Escapes a special character", "caret": "^ - Inside a character set, negates the set", "pipe": "| - Alternation, matches either the pattern before or after the pipe", "squareBrackets": "[] - Character set, matches any character within the brackets" }, "flags": { "ignoreCase": "IgnoreCase - Case insensitive matching", "multiline": "Multiline - ^ and $ match start and end of a line", "singleLine": "Singleline - Dot matches all, including newline", "explicitCapture": "ExplicitCapture - Only named groups are captured", "ignorePatternWhitespace": "IgnorePatternWhitespace - Ignores whitespace and comments in the pattern", "rightToLeft": "RightToLeft - Search proceeds from right to left" }, "additionalFeatures": { "backReferences": "\\1, \\2, ... - Back references to capturing groups", "conditionalPatterns": "(?(expression)yes|no) - Conditional patterns", "inlineOptions": "(?imnsx-imnsx) - Inline options to turn on/off flags within the pattern" } } ================================================ FILE: regex/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards. ================================================ FILE: template/.github/FUNDING.yml ================================================ # These are supported funding model platforms custom: ['https://www.paypal.com/paypalme/seller/Hadrio/dashboard'] ================================================ FILE: template/Conversation Starters ================================================ How do I integrate Firebase Authentication? Tell me about Firebase Cloud Functions. Best practices for Firebase Realtime Database? Troubleshooting Firebase Firestore issues? ================================================ FILE: template/Instructions ================================================ This GPT is an expert in Firebase plugins and integration, providing detailed assistance and guidance on implementing and troubleshooting Firebase features in various software projects. It will offer step-by-step instructions, best practices, and troubleshooting tips tailored to specific Firebase-related queries. The GPT will focus on clarifying complex concepts, making Firebase integration more accessible to users with varying levels of experience. It will avoid providing outdated information, focus on Firebase's current capabilities, and ensure to clarify when additional context is needed for a query. The GPT's responses will be technical, accurate, and up-to-date, reflecting a deep understanding of Firebase and its ecosystem. ================================================ FILE: template/actions ================================================ !! In progress. This file is not live yet { "openapi": "3.1.0", "info": { "title": "GitHub Code Repository Data", "description": "Accesses code examples from the specified GitHub repository.", "version": "v1.0.0" }, "servers": [ { "url": "https://api.github.com" } ], "paths": { "/repos/{owner}/{repo}/contents/{path}": { "get": { "description": "Retrieve file content from a GitHub repository", "operationId": "GetRepoContent", "parameters": [ { "name": "owner", "in": "path", "description": "Owner of the repository", "required": true, "schema": { "type": "string" } }, { "name": "repo", "in": "path", "description": "Repository name", "required": true, "schema": { "type": "string" } }, { "name": "path", "in": "path", "description": "File path within the repository", "required": true, "schema": { "type": "string" } } ], "deprecated": false } } }, "components": { "schemas": {} } } ================================================ FILE: template/knowledge/standards ================================================ This guide contains standards for the assistant to adhere to. Adhering to standards is suggested but not required if it leads to poor solutions. The specifications of the user override the standards.