Compare commits

..
Author SHA1 Message Date
malo 7e7a5c8df5 chore(release): publish packages
- wyatt_crud_bloc_firestore@0.2.0+3
2025-06-11 13:58:40 +02:00
malo 742cca6f71 chore: update pubspec inter deps 2025-06-11 08:51:55 +02:00
malo ea44204308 chore(release): publish packages
- wyatt_ui_layout@0.1.3+2
2025-05-21 17:36:08 +02:00
malo b43b9fe3ac chore: update pubspec inter deps 2025-05-21 17:35:47 +02:00
malo ad17a92094 chore(release): publish packages
- wyatt_ui_layout@0.1.3+1
2025-05-21 17:30:37 +02:00
malo 7e9922ca75 chore: update pubspec inter deps 2025-05-21 17:26:04 +02:00
malo 2ae3f153eb chore(release): publish packages
- wyatt_bloc_helper@2.0.3
2025-05-21 17:11:26 +02:00
malo 9356519e17 chore(release): publish packages
- architecture_example@2.0.0
 - bloc_helper_example@1.1.0
 - bloc_layout_example@2.0.0
 - component_copy_with_extension_example@1.1.0
 - component_copy_with_gen_example@1.1.0
 - crud_bloc_example@2.0.0
 - example_router@2.0.0
 - form_bloc_example@2.0.0
 - notification_bloc_example@1.0.1
 - type_utils_example@1.1.0
 - wyatt_continuous_deployment@1.1.1
 - wyatt_continuous_deployment_example@1.0.1
 - wyatt_i18n_example@2.0.0
 - wyatt_type_utils@0.1.0+1
 - wyatt_ui_components_example@2.0.0
 - wyatt_ui_kit_example@2.0.0
 - wyatt_ui_layout_example@2.0.0
 - wyatt_cloud_messaging_bloc_base@0.1.1+5
 - wyatt_authentication_bloc@0.6.0+1
 - wyatt_crud_bloc_firestore@0.2.0+2
 - wyatt_crud_bloc@0.2.0+2
 - wyatt_i18n@2.0.4
 - wyatt_architecture@0.2.0+3
 - wyatt_form_bloc@0.2.0+6
 - wyatt_cloud_messaging_bloc_firebase@0.1.0+5
 - wyatt_bloc_layout@0.1.2+7
 - cloud_messaging_bloc_firebase_example@1.0.1
2025-05-21 17:04:58 +02:00
malo 9a8fb28d57 refactor(utils): fix warnings 2025-05-21 16:20:43 +02:00
malo 06ea7b73ae refactor(cd): fiw injectable warning 2025-05-21 16:15:57 +02:00
malo d5ef2124e3 chore(release): publish packages
- wyatt_analysis@2.7.0
 - wyatt_architecture@0.2.0+2
 - wyatt_authentication_bloc@0.6.0
 - wyatt_cloud_messaging_bloc_base@0.1.1+4
 - wyatt_continuous_deployment@1.1.0
 - wyatt_form_bloc@0.2.0+5
 - wyatt_go_router@1.0.1
 - wyatt_http_client@2.0.2
 - wyatt_type_utils@0.1.0
 - wyatt_ui_components@0.4.0
 - wyatt_ui_layout@0.1.3
 - wyatt_crud_bloc_firestore@0.2.0+1
 - wyatt_crud_bloc@0.2.0+1
 - wyatt_i18n@2.0.3
 - wyatt_cloud_messaging_bloc_firebase@0.1.0+4
 - wyatt_bloc_layout@0.1.2+6
 - wyatt_ui_kit@3.2.5
2025-05-21 16:06:29 +02:00
malo 9cb8a93d9d chore: upgrade deps 2025-05-21 15:57:39 +02:00
hugo 0a3f0094c4 docs(router): add missing template name 2024-03-29 20:16:18 +00:00
hugo 6fd18e7aca chore: update melos config
continuous-integration/drone/pr Build is failing
2024-03-29 21:15:07 +01:00
hugo d69106adeb fix(cd): make cd use new usecases
continuous-integration/drone/pr Build is failing
2024-03-29 21:08:59 +01:00
hugo cca7b29a6d fix(authentication)!: use correct usecase and result 2024-03-29 21:02:06 +01:00
hugo 283bf80243 fix(notification): port the new usecase syntax 2024-03-29 21:01:19 +01:00
hugo d217a202cb chore: update melos 2024-03-29 21:00:25 +01:00
malo 48c5215c70 feat: fetch certs in read-only
continuous-integration/drone/pr Build is failing
2024-02-29 13:13:07 +00:00
malo dc9ce095b4 chore: version bin folder
continuous-integration/drone/pr Build is failing
2024-02-29 10:00:03 +00:00
malo 3cebc34e46 refactor: rename default cd config file from wyatt.yaml to cd_config.yaml
continuous-integration/drone/pr Build is failing
2024-02-19 15:07:37 +00:00
malo 3706ab8f1c chore(wyatt_continuous_deployment): migrate the all CLI as package
continuous-integration/drone/pr Build is failing
2024-02-19 12:57:59 +00:00
hugo 995e122c1b fix(wyatt_cd): make getIt initializable
continuous-integration/drone/pr Build is failing
2024-02-18 23:20:30 +01:00
hugo 1492745e54 docs(wyatt_architecture): update readme 2024-02-18 23:00:01 +01:00
hugo 08218f7080 chore(wyatt_cd): add wyatt continuous deployment package 2024-02-18 22:49:47 +01:00
hugo 59bca9045e refactor(wyatt_architecture): upgrade usecases to add NoParams 2024-02-18 22:49:11 +01:00
hugo 41382aad2f refactor(wyatt_type_utils)!: upgrade Result to prepare migration to sealed classes 2024-02-18 22:48:20 +01:00
hugo 7785f3f117 chore(release): publish packages
continuous-integration/drone/pr Build is failing
- wyatt_bloc_helper@2.0.2
 - wyatt_bloc_layout@0.1.2+5
 - wyatt_cloud_messaging_bloc_base@0.1.1+3
 - wyatt_i18n@2.0.2
 - wyatt_ui_kit@3.2.4
 - wyatt_cloud_messaging_bloc_firebase@0.1.0+3
2023-11-18 18:08:43 +01:00
hugo e030375fec fix: compilation issue with flutter 3.16.0 and generics name
continuous-integration/drone/pr Build is failing
2023-11-18 17:50:27 +01:00
hugo 375bb8f04a feat: add generic card 2023-11-17 15:21:45 +00:00
hugo 1cadba5cd5 build(router): add publish_to url
continuous-integration/drone/pr Build is failing
2023-11-14 18:38:20 +01:00
hugo 75340f1b5a docs: update readme with new logo
continuous-integration/drone/pr Build is failing
2023-11-14 18:20:46 +01:00
hugo 78456c01a6 build: remove master restriction in melos since we rebase 2023-11-14 18:20:04 +01:00
hugo 45458e7784 chore: initialize go router package
continuous-integration/drone/pr Build is failing
2023-11-14 18:19:10 +01:00
313 changed files with 8315 additions and 1101 deletions
+481
View File
@@ -3,6 +3,487 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## 2025-06-11
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_crud_bloc_firestore` - `v0.2.0+3`](#wyatt_crud_bloc_firestore---v0203)
---
#### `wyatt_crud_bloc_firestore` - `v0.2.0+3`
## 2025-05-21
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_ui_layout` - `v0.1.3+2`](#wyatt_ui_layout---v0132)
---
#### `wyatt_ui_layout` - `v0.1.3+2`
## 2025-05-21
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_ui_layout` - `v0.1.3+1`](#wyatt_ui_layout---v0131)
---
#### `wyatt_ui_layout` - `v0.1.3+1`
## 2025-05-21
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_bloc_helper` - `v2.0.3`](#wyatt_bloc_helper---v203)
---
#### `wyatt_bloc_helper` - `v2.0.3`
## 2025-05-21
### Changes
---
Packages with breaking changes:
- [`architecture_example` - `v2.0.0`](#architecture_example---v200)
- [`bloc_layout_example` - `v2.0.0`](#bloc_layout_example---v200)
- [`crud_bloc_example` - `v2.0.0`](#crud_bloc_example---v200)
- [`example_router` - `v2.0.0`](#example_router---v200)
- [`form_bloc_example` - `v2.0.0`](#form_bloc_example---v200)
- [`wyatt_i18n_example` - `v2.0.0`](#wyatt_i18n_example---v200)
- [`wyatt_ui_components_example` - `v2.0.0`](#wyatt_ui_components_example---v200)
- [`wyatt_ui_kit_example` - `v2.0.0`](#wyatt_ui_kit_example---v200)
- [`wyatt_ui_layout_example` - `v2.0.0`](#wyatt_ui_layout_example---v200)
Packages with other changes:
- [`bloc_helper_example` - `v1.1.0`](#bloc_helper_example---v110)
- [`component_copy_with_extension_example` - `v1.1.0`](#component_copy_with_extension_example---v110)
- [`component_copy_with_gen_example` - `v1.1.0`](#component_copy_with_gen_example---v110)
- [`notification_bloc_example` - `v1.0.1`](#notification_bloc_example---v101)
- [`type_utils_example` - `v1.1.0`](#type_utils_example---v110)
- [`wyatt_continuous_deployment` - `v1.1.1`](#wyatt_continuous_deployment---v111)
- [`wyatt_continuous_deployment_example` - `v1.0.1`](#wyatt_continuous_deployment_example---v101)
- [`wyatt_type_utils` - `v0.1.0+1`](#wyatt_type_utils---v0101)
- [`wyatt_cloud_messaging_bloc_base` - `v0.1.1+5`](#wyatt_cloud_messaging_bloc_base---v0115)
- [`wyatt_authentication_bloc` - `v0.6.0+1`](#wyatt_authentication_bloc---v0601)
- [`wyatt_crud_bloc_firestore` - `v0.2.0+2`](#wyatt_crud_bloc_firestore---v0202)
- [`wyatt_crud_bloc` - `v0.2.0+2`](#wyatt_crud_bloc---v0202)
- [`wyatt_i18n` - `v2.0.4`](#wyatt_i18n---v204)
- [`wyatt_architecture` - `v0.2.0+3`](#wyatt_architecture---v0203)
- [`wyatt_form_bloc` - `v0.2.0+6`](#wyatt_form_bloc---v0206)
- [`wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+5`](#wyatt_cloud_messaging_bloc_firebase---v0105)
- [`wyatt_bloc_layout` - `v0.1.2+7`](#wyatt_bloc_layout---v0127)
- [`cloud_messaging_bloc_firebase_example` - `v1.0.1`](#cloud_messaging_bloc_firebase_example---v101)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `wyatt_cloud_messaging_bloc_base` - `v0.1.1+5`
- `wyatt_authentication_bloc` - `v0.6.0+1`
- `wyatt_crud_bloc_firestore` - `v0.2.0+2`
- `wyatt_crud_bloc` - `v0.2.0+2`
- `wyatt_i18n` - `v2.0.4`
- `wyatt_architecture` - `v0.2.0+3`
- `wyatt_form_bloc` - `v0.2.0+6`
- `wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+5`
- `wyatt_bloc_layout` - `v0.1.2+7`
- `cloud_messaging_bloc_firebase_example` - `v1.0.1`
---
#### `architecture_example` - `v2.0.0`
- **REFACTOR**(wyatt_architecture): upgrade usecases to add NoParams.
- **REFACTOR**(architecture): update naming methodes (close #47).
- **REFACTOR**(architecture): update example. (close #38).
- **FIX**: apply dart fix --apply.
- **FIX**: remove wyatt arch ios example.
- **FEAT**(arch): add new project for wyatt clean architecture.
- **DOCS**(arch): add documentation.
- **BREAKING** **REFACTOR**(http): fix cascade dart good practices + docs.
#### `bloc_layout_example` - `v2.0.0`
- **REFACTOR**(bloc_layouts): refactored block using the ui layout package, due to breaking changes.
- **REFACTOR**(bloc_layout): remove cross package export.
- **REFACTOR**(bloc_layout): migrate bloc layouts using copywith component method (close #121).
- **REFACTOR**(bloc_layout): update example (#92).
- **REFACTOR**(bloc_layout): update example with new app bar entity (#90).
- **FIX**: apply dart fix --apply.
- **FIX**: remove wyatt arch ios example.
- **FIX**(ui): change example to be compatible with new AppTopBar and TextWrapper.
- **FIX**(bloc_layout): fix textwrapper.
- **FEAT**(bloc_layout): rework on structure using new components and layouts.
- **FEAT**(bloc_layout): add new package to combine bloc_helper, crud_bloc, ui_components, and ui_layout.
- **BREAKING** **FEAT**(layout): update layout plugins with new components system.
#### `crud_bloc_example` - `v2.0.0`
- **FIX**: rename wyatt_bruc_bloc_firestore main package file.
- **FIX**(crud): update example.
- **FEAT**(crud): add streaming usecase (closes #180).
- **FEAT**(crud): change responsibility of blocs (closes #45, closes #44).
- **DOCS**(crud): add example app.
- **BREAKING** **FEAT**(crud): make crudbuilder integration more easy by integrating blocbuilder (closes #181).
- **BREAKING** **FEAT**(crud): move crud firestore implementation into his own package.
#### `example_router` - `v2.0.0`
- **REFACTOR**(authentication): remove cross package export.
- **REFACTOR**(authentication): use fromFirebaseUser factory to parse user.
- **REFACTOR**(auth): update example with new input builders.
- **FIX**(authentication_bloc): upgrade google sign to his major v.
- **FIX**(authentication_bloc): go router version refactoring.
- **FIX**(authentication): make sur access token is available on every steps.
- **FIX**(authentication): allow email/password validators customization (closes #57).
- **FIX**(auth): fix some bugs to validate publishing.
- **FIX**(auth): update form plugin and fix auth.
- **FIX**(auth): example needs multidex support.
- **FEAT**(authentication): remove session wrapper for AuthenticationSession.
- **FEAT**(authentication): add custom routine, and documentation.
- **FEAT**(authentication): add full event support.
- **FEAT**(authentication): add google sign in in signIn cubit.
- **FEAT**(auth): add reactive repo + extra data + router examples + tests.
- **FEAT**(auth): add google, facebook, apple, twitter login.
- **DOCS**(authentication): update example with multiple data sources.
- **DOCS**(authentication): add full dartdoc.
- **DOCS**(authentication): update example.
- **DOCS**(authentication): update example.
- **DOCS**(auth): add correct header.
- **BREAKING** **FIX**(authentication): use correct usecase and result.
- **BREAKING** **FIX**(authentication): use FutureOrResult extension (close #41).
- **BREAKING** **FIX**(auth): add signInWithEmailAndPassword and signInAnonymously methods in SignInCubit #26.
- **BREAKING** **FEAT**(authentication): add repo in callback usecases (close #55).
- **BREAKING** **FEAT**(auth): use form_bloc package.
- **BREAKING** **FEAT**(authentication): rename package.
#### `form_bloc_example` - `v2.0.0`
- **REFACTOR**(form): refactor simple example.
- **FEAT**(from): add form validator class with strategy design pattern.
- **BREAKING** **REFACTOR**(form): input builders provides FormInput.
#### `wyatt_i18n_example` - `v2.0.0`
- **FIX**: apply dart fix --apply.
- **FEAT**(i18n): add i18n delegate + example.
- **FEAT**(i18n): add ICU parser.
- **FEAT**(i18n): add arb, json and yaml parsers.
- **BREAKING** **FEAT**(i18n): rename few files + add clearer documentation.
#### `wyatt_ui_components_example` - `v2.0.0`
- **REFACTOR**(ui_components): migrate top nav bar using generify top bar.
- **REFACTOR**(ui_components): update example (close #115).
- **REFACTOR**(ui_component): update example (#92).
- **REFACTOR**(ui_components): update example (#92).
- **FIX**: remove wyatt arch ios example.
- **FEAT**: add items manipulation in bottom bar component.
- **FEAT**(ui): add colors and rework ComponentThemeData.
- **FEAT**(ui): make gradient as component.
- **FEAT**(ui_components): update attributs and proxy most of appbar attributs.
- **FEAT**(ui_components): add centerTitle property to app bar component.
- **FEAT**(ui): add some useful text customization in TextWrapper (closes #149).
- **FEAT**(ui_component): add string extension to easely wrap text.
- **FEAT**(ui_components): add text wrapper instead of String/Widget for Texts.
- **FEAT**(ui_components): add information_card & quote_card (#126).
- **FEAT**(ui_components): make component data field nullable (#92).
- **FEAT**(ui_components): make app bar leading & actions customizable.
- **FEAT**(ui_layout): update example & move configure function (#69).
- **FEAT**: create new package to split components and layouts.
- **BREAKING** **FEAT**(ui_components): available same type component usage (#200).
- **BREAKING** **FEAT**(ui): move last extensions + add extension provider.
#### `wyatt_ui_kit_example` - `v2.0.0`
- **REFACTOR**(ui): rework text gradient and text wrapper.
- **REFACTOR**(ui_kit): use tapped state and merged styles.
- **REFACTOR**(ui_kit): Refactored code using the UI components package, due to breaking changes.
- **REFACTOR**(ui_kit): update textinput component using borderColors as Color.
- **FIX**(ui_kit): add cacheExtend as a trade-off in listview example.
- **FIX**: apply dart fix --apply.
- **FIX**(ui_kit): add local font assets + compress images.
- **FIX**(ui_kit): fix text align, add selection and update example for rich text builder.
- **FIX**: upgrade to flutter 3.10.
- **FIX**(ui_kit): remove null check operator in Loader component.
- **FEAT**(ui_kit): make skillcard header icon customizable.
- **FEAT**(ui_kit): implement flat button.
- **FEAT**: implement notification abstraction package.
- **FEAT**(ui_kit): implement top nav bar.
- **FEAT**(ui_kit): implement top app bar and update example.
- **FEAT**(ui_kit): add card theme extension, fix bugs & update example (close #126).
- **FEAT**(ui_kit): add quote / skill / portfolio cards (#126).
- **FEAT**(ui_kit): update example (#138).
- **FEAT**(ui_kit): update example by removing adaptative theme.
- **FEAT**(ui_kit): implement rich text builder (closes #141).
- **FEAT**(ui): add pricing card.
- **FEAT**(ui_kit): update example with full studio button theme.
- **FEAT**(ui_kit): add theme control in example.
- **FEAT**(ui_kit): finalize material ready buttons.
- **FEAT**(ui_kit): implement information card (#126).
- **FEAT**(ui): update default extension implementation.
- **FEAT**(ui_kit): update example with drawer and custom launch parameters.
- **FEAT**(ui_kit): implement file selection button with invalid cubit and dotted package.
- **FEAT**(ui_kit): implement simple icon button and use dimension style.
- **FEAT**(ui_kit): add symbol button + enhance bloc control over state.
- **FEAT**(ui_kit): allow to cascade styles in ThemeHelper.
- **FEAT**(ui_kit): use MultiColor in button style.
- **FEAT**(ui_kit): implement flat/outlined button.
- **FEAT**(ui): add animated decorated box + animate all buttons + customize duration in style.
- **BREAKING** **REFACTOR**(ui): remove bloc export in buttons to be state management solution agnostic (closes #147).
- **BREAKING** **FEAT**(ui): rework theme resolver mechanism + move theme extension implementations.
- **BREAKING** **FEAT**(ui): move last extensions + add extension provider.
#### `wyatt_ui_layout_example` - `v2.0.0`
- **REFACTOR**(ui_layouts): Refactored block using the UI components package, introducing breaking changes.
- **REFACTOR**(ui_layout): update exemple (close #116).
- **REFACTOR**(ui_layout): update example (#92).
- **REFACTOR**(ui_layout): update example with components updates (close #90).
- **REFACTOR**(ui_layout): update field name.
- **FIX**: remove wyatt arch ios example.
- **FIX**(ui): change example to be compatible with new AppTopBar and TextWrapper.
- **FIX**(ui_layout): fix textwrapper.
- **FIX**(ui_layout): fix emample after splititng packages.
- **FEAT**: implement notification abstraction package.
- **FEAT**: update layouts to allow more control on components.
- **FEAT**(ui_layout): add new package for app compenant and start implementing layouts.
- **DOCS**: add doc.
- **BREAKING** **FEAT**(layout): update layout plugins with new components system.
#### `bloc_helper_example` - `v1.1.0`
- **FIX**: compilation issue with flutter 3.16.0 and generics name.
- **FEAT**(bloc): add a lot of docs, fix `onWrap`, and add repo provider.
- **FEAT**(bloc): add provider, consumer and helpers.
- **DOCS**(bloc): add ios example.
#### `component_copy_with_extension_example` - `v1.1.0`
- **FIX**: remove wyatt arch ios example.
- **FEAT**: add class annotation for component code generators.
#### `component_copy_with_gen_example` - `v1.1.0`
- **FIX**: remove wyatt arch ios example.
- **FIX**(ui): change example to be compatible with new AppTopBar and TextWrapper.
- **FIX**(cw_gen): fix textwrapper.
- **FIX**(component_copy_with_gen): update example (#118).
- **FEAT**: add generators for components proxy and mixins to enable copywith methods.
#### `notification_bloc_example` - `v1.0.1`
- **FIX**: apply dart format.
#### `type_utils_example` - `v1.1.0`
- **FEAT**(types): add strongly typed Option and Result.
- **FEAT**(types): add mason generated package.
- **DOCS**: remove useless web example.
#### `wyatt_continuous_deployment` - `v1.1.1`
- **REFACTOR**(cd): fiw injectable warning.
#### `wyatt_continuous_deployment_example` - `v1.0.1`
- **FIX**(cd): make cd use new usecases.
#### `wyatt_type_utils` - `v0.1.0+1`
- **REFACTOR**(utils): fix warnings.
## 2025-05-21
### Changes
---
Packages with breaking changes:
- [`wyatt_authentication_bloc` - `v0.6.0`](#wyatt_authentication_bloc---v060)
- [`wyatt_type_utils` - `v0.1.0`](#wyatt_type_utils---v010)
- [`wyatt_ui_components` - `v0.4.0`](#wyatt_ui_components---v040)
Packages with other changes:
- [`wyatt_analysis` - `v2.7.0`](#wyatt_analysis---v270)
- [`wyatt_architecture` - `v0.2.0+2`](#wyatt_architecture---v0202)
- [`wyatt_cloud_messaging_bloc_base` - `v0.1.1+4`](#wyatt_cloud_messaging_bloc_base---v0114)
- [`wyatt_continuous_deployment` - `v1.1.0`](#wyatt_continuous_deployment---v110)
- [`wyatt_form_bloc` - `v0.2.0+5`](#wyatt_form_bloc---v0205)
- [`wyatt_go_router` - `v1.0.1`](#wyatt_go_router---v101)
- [`wyatt_http_client` - `v2.0.2`](#wyatt_http_client---v202)
- [`wyatt_ui_layout` - `v0.1.3`](#wyatt_ui_layout---v013)
- [`wyatt_crud_bloc_firestore` - `v0.2.0+1`](#wyatt_crud_bloc_firestore---v0201)
- [`wyatt_crud_bloc` - `v0.2.0+1`](#wyatt_crud_bloc---v0201)
- [`wyatt_i18n` - `v2.0.3`](#wyatt_i18n---v203)
- [`wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+4`](#wyatt_cloud_messaging_bloc_firebase---v0104)
- [`wyatt_bloc_layout` - `v0.1.2+6`](#wyatt_bloc_layout---v0126)
- [`wyatt_ui_kit` - `v3.2.5`](#wyatt_ui_kit---v325)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `wyatt_crud_bloc_firestore` - `v0.2.0+1`
- `wyatt_crud_bloc` - `v0.2.0+1`
- `wyatt_i18n` - `v2.0.3`
- `wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+4`
- `wyatt_bloc_layout` - `v0.1.2+6`
- `wyatt_ui_kit` - `v3.2.5`
---
#### `wyatt_authentication_bloc` - `v0.6.0`
- **FIX**(authentication_bloc): upgrade google sign to his major v.
- **FIX**: apply dart format.
- **FIX**: apply dart fix --apply.
- **FIX**(authentication_bloc): go router version refactoring.
- **FIX**: use correct behavior subject for stream session.
- **BREAKING** **FIX**(authentication): use correct usecase and result.
#### `wyatt_type_utils` - `v0.1.0`
- **BREAKING** **REFACTOR**(wyatt_type_utils): upgrade Result to prepare migration to sealed classes.
#### `wyatt_ui_components` - `v0.4.0`
- **FIX**: make components nullable.
- **FIX**(ui_components): rollback private fileds in component theme data.
- **FIX**: apply dart format.
- **FEAT**: add generic card.
- **FEAT**(ui_components): marking fields as private since it was accessible from getters.
- **BREAKING** **FEAT**(ui_components): available same type component usage (#200).
#### `wyatt_analysis` - `v2.7.0`
- **REFACTOR**: rename tools/ to tool/ to follow dart conventions.
- **FIX**: remove not yet implemented rule.
- **FEAT**(analysis): remove describe properties rule.
- **FEAT**: upgrade to handle dart 3.0.0.
- **FEAT**(analysis): add full toolchain to easely update ruleset.
#### `wyatt_architecture` - `v0.2.0+2`
- **REFACTOR**(wyatt_architecture): upgrade usecases to add NoParams.
- **FIX**: apply dart fix --apply.
- **DOCS**(wyatt_architecture): update readme.
#### `wyatt_cloud_messaging_bloc_base` - `v0.1.1+4`
- **FIX**(notification): port the new usecase syntax.
#### `wyatt_continuous_deployment` - `v1.1.0`
- **REFACTOR**: rename default cd config file from wyatt.yaml to cd_config.yaml.
- **FIX**(cd): make cd use new usecases.
- **FIX**(wyatt_cd): make getIt initializable.
- **FEAT**: fetch certs in read-only.
#### `wyatt_form_bloc` - `v0.2.0+5`
- **FIX**: apply dart format.
#### `wyatt_go_router` - `v1.0.1`
- **DOCS**(router): add missing template name.
#### `wyatt_http_client` - `v2.0.2`
- **FIX**: apply dart fix --apply.
#### `wyatt_ui_layout` - `v0.1.3`
- **REFACTOR**(ui_layouts): Refactored block using the UI components package, introducing breaking changes.
- **FIX**(ui_layout): fix bottom navbar layouts.
- **FIX**(ui_layout): fix topappbar layouts.
- **FIX**: make components nullable.
- **FEAT**: implement notification abstraction package.
## 2023-11-18
### Changes
---
Packages with breaking changes:
- There are no breaking changes in this release.
Packages with other changes:
- [`wyatt_bloc_helper` - `v2.0.2`](#wyatt_bloc_helper---v202)
- [`wyatt_bloc_layout` - `v0.1.2+5`](#wyatt_bloc_layout---v0125)
- [`wyatt_cloud_messaging_bloc_base` - `v0.1.1+3`](#wyatt_cloud_messaging_bloc_base---v0113)
- [`wyatt_i18n` - `v2.0.2`](#wyatt_i18n---v202)
- [`wyatt_ui_kit` - `v3.2.4`](#wyatt_ui_kit---v324)
- [`wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+3`](#wyatt_cloud_messaging_bloc_firebase---v0103)
Packages with dependency updates only:
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
- `wyatt_bloc_layout` - `v0.1.2+5`
- `wyatt_cloud_messaging_bloc_base` - `v0.1.1+3`
- `wyatt_i18n` - `v2.0.2`
- `wyatt_ui_kit` - `v3.2.4`
- `wyatt_cloud_messaging_bloc_firebase` - `v0.1.0+3`
---
#### `wyatt_bloc_helper` - `v2.0.2`
- **FIX**: compilation issue with flutter 3.16.0 and generics name.
## 2023-11-14 ## 2023-11-14
### Changes ### Changes
+44 -37
View File
@@ -36,23 +36,23 @@
<!-- code_chunk_output --> <!-- code_chunk_output -->
* [About](#about) - [About](#about)
* [Contribution](#contribution) - [Usage](#usage)
+ [Prerequisite](#prerequisite) - [Contribution](#contribution)
+ [Create a new package](#create-a-new-package) - [Prerequisite](#prerequisite)
- [Create a new package](#create-a-new-package)
- [Naming](#naming) - [Naming](#naming)
+ [Create issues](#create-issues) - [Create issues](#create-issues)
+ [Branches](#branches) - [Branches](#branches)
+ [Commits](#commits) - [Commits](#commits)
- [Before pushing](#before-pushing) - [Before pushing](#before-pushing)
+ [Merge your work](#merge-your-work) - [Merge your work](#merge-your-work)
+ [Update version.](#update-version) - [Update version.](#update-version)
+ [Publish your package](#publish-your-package) - [Publish your package](#publish-your-package)
+ [Badging](#badging) - [Badging](#badging)
* [Usage](#usage) - [Simple work flow diagramm](#simple-work-flow-diagramm)
* [Simple work flow diagramm](#simple-work-flow-diagramm) - [Status](#status)
* [Status](#status) - [License](#license)
* [License](#license)
<!-- /code_chunk_output --> <!-- /code_chunk_output -->
@@ -68,6 +68,21 @@ Those packages are developed by [Wyatt Studio](https://wyatt-studio.fr) and are
--- ---
## Usage
You can add any package of the `packages/` sub directory in your project.
```yaml
dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.4.1
```
> You can also use the `git` protocol. But it's not recommended since it's not handle version constraints.
---
## Contribution ## Contribution
Clone this repo. Clone this repo.
@@ -109,12 +124,17 @@ Create a new package in `packages/` folder.
To create a new package in the packages/ folder, run the following command in the terminal: To create a new package in the packages/ folder, run the following command in the terminal:
```shell ```shell
mason make wyatt_package_template --package_name <name> --description A new Wyatt package --flutter false mason upgrade
mason make wyatt_package_template \
--package_name <name> \
--description A new Wyatt package \
--flutter false
-o packages/<name>
``` ```
> Browse our [bricks](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-bricks) for more information. > Browse our [bricks](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-bricks) for more information.
The <name> variable in the above command is important and must be clear and understandable. The `<name>` variable in the above command is important and must be clear and understandable. (see [Naming](#naming))
After creating the package, bootstrap the project with the `melos bs` command. After creating the package, bootstrap the project with the `melos bs` command.
@@ -129,7 +149,7 @@ It have to be clear and intelligible.
For example, if the name is `CRUD BLOC` the following naming conventions should be used: For example, if the name is `CRUD BLOC` the following naming conventions should be used:
1. package name: `wyatt_crud_bloc` 1. package name: `wyatt_crud_bloc`
2. example name: `example` 2. example name: `wyatt_crud_bloc_example`
### Create issues ### Create issues
@@ -141,7 +161,9 @@ For example, if you want to work on the `i18n` package, you should create an iss
The `master` branch is protected and cannot be pushed to directly. Please create a separate branch for each feature or task, with a name that corresponds to the related issue. The branch name should follow this format: The `master` branch is protected and cannot be pushed to directly. Please create a separate branch for each feature or task, with a name that corresponds to the related issue. The branch name should follow this format:
`scope/type/short-name` ```text
scope/type/short-name
```
For example, if you are working on the `i18n` package and you want to add a new feature, you should create a branch named `i18n/feat/add-new-feature` . For example, if you are working on the `i18n` package and you want to add a new feature, you should create a branch named `i18n/feat/add-new-feature` .
@@ -172,9 +194,9 @@ Some examples :
* `docs: update readme.` = update **this** readme file. * `docs: update readme.` = update **this** readme file.
* `fix(crud)!: fix bug in awesome() function. (closes #32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue. * `fix(crud)!: fix bug in awesome() function. (closes #32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue.
When you have completed your development work and are ready to resolve the related issue, you can close it via your commit message by including (closes #issue_number). For example: When you have completed your development work and are ready to resolve the related issue, you can close it via your commit message by including `(closes #issue_number)` . For example:
```shell ```text
feat(auth): add AWS support. (closes #31) feat(auth): add AWS support. (closes #31)
``` ```
@@ -262,22 +284,7 @@ or
``` ```
> Some packages requires Flutter, so please specify it. > **Warning** Some packages requires Flutter, so please specify it.
---
## Usage
You can add any package of the `packages/` sub directory in your project.
```yaml
dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.4.1
```
> You can also use the `git` protocol. But it's not recommended since it's not handle version constraints.
--- ---
+1 -1
View File
@@ -1 +1 @@
{"bricks":{"wyatt_component_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_component_template","ref":"7cea909470ce75b91840f479649b93f953ded596"}}}} {"bricks":{"wyatt_component_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_component_template","ref":"1f3807adb548a7d65ead7f19e8b743462cb6be22"}},"wyatt_package_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package_template","ref":"1f3807adb548a7d65ead7f19e8b743462cb6be22"}}}}
+6 -21
View File
@@ -1,10 +1,12 @@
name: Wyatt-Packages name: Wyatt-Packages
# repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
sdkPath: auto
packages: packages:
- packages/** - "packages/**"
ignore:
- "packages/**/.dart_tool/**"
sdkPath: auto
ide: ide:
intellij: intellij:
@@ -16,7 +18,6 @@ command:
linkToCommits: false # Gitea not yet supported linkToCommits: false # Gitea not yet supported
workspaceChangelog: true workspaceChangelog: true
includeCommitId: false # Generate error in Melos 3... includeCommitId: false # Generate error in Melos 3...
branch: master
message: | message: |
chore(release): publish packages chore(release): publish packages
@@ -27,11 +28,6 @@ command:
post: melos exec --flutter --concurrency=3 -- "flutter clean" post: melos exec --flutter --concurrency=3 -- "flutter clean"
scripts: scripts:
analyze:
run: |
melos exec --flutter --concurrency=1 -- flutter analyze --fatal-infos
description: Run `flutter analyze` for all flutter packages.
fix:apply: fix:apply:
run: melos exec --concurrency=1 -- dart fix . --apply run: melos exec --concurrency=1 -- dart fix . --apply
description: Run and apply `dart fix` for all packages. description: Run and apply `dart fix` for all packages.
@@ -40,14 +36,6 @@ scripts:
run: melos exec --concurrency=1 -- dart fix . --set-exit-if-changed run: melos exec --concurrency=1 -- dart fix . --set-exit-if-changed
description: Run `dart fix` checks for all packages. description: Run `dart fix` checks for all packages.
format:
run: melos exec --concurrency=1 -- dart format .
description: Run `dart format` for all packages.
lint:all:
run: melos run analyze && melos run format
description: Run all static analysis checks.
clean:deep: clean:deep:
run: git clean -x -d -f -q run: git clean -x -d -f -q
description: Clean things very deeply with `git clean`. description: Clean things very deeply with `git clean`.
@@ -101,6 +89,3 @@ scripts:
description: | description: |
Validate that all packages are ready to be published. Validate that all packages are ready to be published.
Note: This will not actually publish anything. Note: This will not actually publish anything.
# publish:
# run: melos publish --diff="origin/$DRONE_COMMIT_BRANCH...HEAD" --no-dry-run --yes
+8
View File
@@ -1,3 +1,11 @@
## 2.7.0
- **REFACTOR**: rename tools/ to tool/ to follow dart conventions.
- **FIX**: remove not yet implemented rule.
- **FEAT**(analysis): remove describe properties rule.
- **FEAT**: upgrade to handle dart 3.0.0.
- **FEAT**(analysis): add full toolchain to easely update ruleset.
## 2.6.1 ## 2.6.1
- **REMOVED** diagnostic_describe_all_properties (https://dart.dev/tools/linter-rules/diagnostic_describe_all_properties) - **REMOVED** diagnostic_describe_all_properties (https://dart.dev/tools/linter-rules/diagnostic_describe_all_properties)
+1 -1
View File
@@ -39,7 +39,7 @@ To use the lints, add a dependency in your `pubspec.yaml` :
```yaml ```yaml
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: 2.6.1 version: 2.7.0
``` ```
Then, add an include in `analysis_options.yaml` : Then, add an include in `analysis_options.yaml` :
+1 -1
View File
@@ -17,7 +17,7 @@
name: wyatt_analysis name: wyatt_analysis
description: Lint rules for Dart and Flutter used internally at Wyatt Studio. description: Lint rules for Dart and Flutter used internally at Wyatt Studio.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis
version: 2.6.1 version: 2.7.0
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
+10
View File
@@ -1,3 +1,13 @@
## 0.2.0+3
- Update a dependency to the latest release.
## 0.2.0+2
- **REFACTOR**(wyatt_architecture): upgrade usecases to add NoParams.
- **FIX**: apply dart fix --apply.
- **DOCS**(wyatt_architecture): update readme.
## 0.2.0+1 ## 0.2.0+1
- **FIX**: apply dart fix --apply. - **FIX**: apply dart fix --apply.
+39 -19
View File
@@ -50,10 +50,10 @@ class Photo extends Entity {
} }
``` ```
Then create the data sources by extending `BaseLocalDataSource` or `BaseRemoteDataSource` depending the type of data source. Then create the data sources by extending `BaseDataSource` :
```dart ```dart
abstract class PhotoRemoteDataSource extends BaseRemoteDataSource { abstract class PhotoRemoteDataSource extends BaseDataSource {
Future<Photo> getPhoto(int id); Future<Photo> getPhoto(int id);
Future<List<Photo>> getAllPhotos({int? start, int? limit}); Future<List<Photo>> getAllPhotos({int? start, int? limit});
} }
@@ -78,14 +78,31 @@ Several use cases are supported :
* Classic usecase : * Classic usecase :
```dart ```dart
class Test extends AsyncUseCase<QueryParameters, List<Photo>>> { class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
const RetrieveAllAlbums(this._photoRepository);
final PhotoRepository _photoRepository;
@override @override
FuturOrResult<List<Photo>>> call(QueryParameters? params) { FutureOrResult<List<Album>> execute(QueryParameters params) {
final photos = _photoRepository.getAllPhotos( final albums = _photoRepository.getAllAlbums(
start: params.start, start: params.start,
limit: params.limit, limit: params.limit,
); );
return albums;
}
}
```
* No parameter usecase :
```dart
class DisplayFavorites extends NoParamsAsyncUseCase<List<Photo>> {
const DisplayFavorites(this._photoRepository);
final PhotoRepository _photoRepository;
@override
FutureOrResult<List<Photo>> execute() {
final photos = _photoRepository.getAllPhotosFromFavorites();
return photos; return photos;
} }
} }
@@ -94,48 +111,51 @@ class Test extends AsyncUseCase<QueryParameters, List<Photo>>> {
You can add alternatve scenarios and check pre/post conditions using our extensions : You can add alternatve scenarios and check pre/post conditions using our extensions :
```dart ```dart
class SearchPhotos extends AsyncUseCase<QueryParameters, List<Photo>>> { class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
const RetrieveAllAlbums(this._photoRepository);
final PhotoRepository _photoRepository;
@override @override
FutureOrResult<List<Photo>>> call(QueryParameters? params) { FutureOrResult<List<Album>> execute(QueryParameters params) {
final photos = _photoRepository.getAllPhotos( final albums = _photoRepository.getAllAlbums(
start: params.start, start: params.start,
limit: params.limit, limit: params.limit,
); );
return photos; return albums;
} }
@override @override
FutureOr<void> onStart(QueryParameters? params) { FutureOr<void> onStart(QueryParameters? params) {
if(params.start == null || params.limit == null){ if (params.start < 0) {
throw ClientException('Préconndition non valides'); throw const ClientException('Invalid start parameter');
} }
} }
} }
``` ```
You can implement error scenarios overriding `onError` , or check postconditions by overriding `onComplete` . You can implement error scenarios overriding `onException` , or check postconditions by overriding `onComplete` .
* Stream usecase : * Stream usecase :
```dart ```dart
class SearchPhotos extends StreamUseCase<QueryParameters, List<Photo>>> { class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
const RetrieveAllAlbums(this._photoRepository);
final PhotoRepository _photoRepository;
@override @override
FutureOrResult<Stream<List<Photo>>>> call(QueryParameters? params) { FutureOrResult<List<Album>> execute(QueryParameters params) {
final photos = _photoRepository.getAllPhotos( final albums = _photoRepository.getAllAlbums(
start: params.start, start: params.start,
limit: params.limit, limit: params.limit,
); );
return photos; return albums;
} }
@override
FutureOrResult<List<Album>> onException(Object e) => Ok([]);
} }
``` ```
On this case, observers allow you to add alternative scenarios when data changed, overriding `onData` or `onDone` .
Please note that to use handlers, call `call` method and not `execute` . Please note that to use handlers, call `call` method and not `execute` .
> In fact, here we need a new parameter object, so let's create it: > In fact, here we need a new parameter object, so let's create it:
@@ -0,0 +1,13 @@
## 2.0.0
> Note: This release has breaking changes.
- **REFACTOR**(wyatt_architecture): upgrade usecases to add NoParams.
- **REFACTOR**(architecture): update naming methodes (close #47).
- **REFACTOR**(architecture): update example. (close #38).
- **FIX**: apply dart fix --apply.
- **FIX**: remove wyatt arch ios example.
- **FEAT**(arch): add new project for wyatt clean architecture.
- **DOCS**(arch): add documentation.
- **BREAKING** **REFACTOR**(http): fix cascade dart good practices + docs.
@@ -88,8 +88,8 @@ class PhotoRepositoryImpl extends PhotoRepository {
} }
return Ok(response); return Ok(response);
} catch (_) { } catch (_) {
return const Err( return Err(
ClientException('Cannot retrieve all photos from favorites.'), const ClientException('Cannot retrieve all photos from favorites.'),
); );
} }
} }
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
abstract class FavoriteLocalDataSource extends BaseLocalDataSource { abstract class FavoriteLocalDataSource extends BaseDataSource {
Future<void> addPhotoToFavorites(Photo photo); Future<void> addPhotoToFavorites(Photo photo);
Future<void> deletePhotoFromFavorites(int id); Future<void> deletePhotoFromFavorites(int id);
Future<List<int>> getAllPhotosFromFavorites(); Future<List<int>> getAllPhotosFromFavorites();
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/album.dart'; import 'package:architecture_example/domain/entities/album.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
abstract class AlbumRemoteDataSource extends BaseRemoteDataSource { abstract class AlbumRemoteDataSource extends BaseDataSource {
Future<Album> getAlbum(int id); Future<Album> getAlbum(int id);
Future<List<Album>> getAllAlbums({int? start, int? limit}); Future<List<Album>> getAllAlbums({int? start, int? limit});
} }
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
abstract class PhotoRemoteDataSource extends BaseRemoteDataSource { abstract class PhotoRemoteDataSource extends BaseDataSource {
Future<Photo> getPhoto(int id); Future<Photo> getPhoto(int id);
Future<List<Photo>> getAllPhotos({int? start, int? limit}); Future<List<Photo>> getAllPhotos({int? start, int? limit});
Future<List<Photo>> getPhotosFromAlbum(int albumId, {int? start, int? limit}); Future<List<Photo>> getPhotosFromAlbum(int albumId, {int? start, int? limit});
@@ -14,14 +14,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> { class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
AddPhotoToFavorites(this._photoRepository); const AddPhotoToFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
@@ -29,11 +27,4 @@ class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
await _photoRepository.addPhotoToFavorites(params!); await _photoRepository.addPhotoToFavorites(params!);
return _photoRepository.getAllPhotosFromFavorites(); return _photoRepository.getAllPhotosFromFavorites();
} }
@override
FutureOr<void> onStart(Photo? params) {
if (params == null) {
throw const ClientException('Photo cannot be null');
}
}
} }
@@ -14,23 +14,14 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> { class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
CheckIfPhotoIsInFavorites(this._photoRepository); const CheckIfPhotoIsInFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
FutureOrResult<bool> execute(int? params) async => FutureOrResult<bool> execute(int? params) async =>
_photoRepository.checkIfPhotoIsInFavorites(params!); _photoRepository.checkIfPhotoIsInFavorites(params!);
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw const ClientException('id cannot be null');
}
}
} }
@@ -18,12 +18,12 @@ import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> { class DisplayFavorites extends NoParamsAsyncUseCase<List<Photo>> {
DisplayFavorites(this._photoRepository); const DisplayFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
FutureOrResult<List<Photo>> execute(void params) { FutureOrResult<List<Photo>> execute() {
final photos = _photoRepository.getAllPhotosFromFavorites(); final photos = _photoRepository.getAllPhotosFromFavorites();
return photos; return photos;
} }
@@ -14,14 +14,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class DisplayPhoto extends AsyncUseCase<int, Photo> { class DisplayPhoto extends AsyncUseCase<int, Photo> {
DisplayPhoto(this._photoRepository); const DisplayPhoto(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
@@ -29,11 +27,4 @@ class DisplayPhoto extends AsyncUseCase<int, Photo> {
final photo = _photoRepository.getPhoto(params!); final photo = _photoRepository.getPhoto(params!);
return photo; return photo;
} }
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw const ClientException('id cannot be null');
}
}
} }
@@ -14,15 +14,13 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart'; import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> { class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
OpenAlbum(this._photoRepository); const OpenAlbum(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
@@ -35,11 +33,4 @@ class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
return photos; return photos;
} }
@override
FutureOr<void> onStart(QueryParameters? params) {
if (params == null) {
throw const ClientException('params cannot be null');
}
}
} }
@@ -14,14 +14,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/entities/photo.dart'; import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> { class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
RemovePhotoFromFavorites(this._photoRepository); const RemovePhotoFromFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
@@ -29,11 +27,4 @@ class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
await _photoRepository.deletePhotoFromFavorites(params!); await _photoRepository.deletePhotoFromFavorites(params!);
return _photoRepository.getAllPhotosFromFavorites(); return _photoRepository.getAllPhotosFromFavorites();
} }
@override
FutureOr<void> onStart(int? params) {
if (params == null) {
throw const ClientException('id cannot be null');
}
}
} }
@@ -14,15 +14,13 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:architecture_example/domain/entities/album.dart'; import 'package:architecture_example/domain/entities/album.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart'; import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart'; import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> { class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
RetrieveAllAlbums(this._photoRepository); const RetrieveAllAlbums(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;
@override @override
@@ -33,11 +31,4 @@ class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
); );
return albums; return albums;
} }
@override
FutureOr<void> onStart(QueryParameters? params) {
if (params == null) {
throw const ClientException('params cannot be null');
}
}
} }
@@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 2.0.0
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: ">=2.17.0 <3.0.0"
@@ -32,36 +32,36 @@ dependencies:
wyatt_architecture: wyatt_architecture:
path: "../" path: "../"
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
get_it: ^7.2.0 get_it: ^8.0.3
hive: ^2.2.3 hive: ^2.2.3
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
equatable: ^2.0.5 equatable: ^2.0.5
stream_transform: ^2.1.0 stream_transform: ^2.1.0
bloc_concurrency: ^0.2.0 bloc_concurrency: ^0.3.0
freezed_annotation: ^2.2.0 freezed_annotation: ^3.0.0
json_annotation: ^4.7.0 json_annotation: ^4.7.0
wyatt_bloc_helper: wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1 version: ^2.0.3
wyatt_http_client: wyatt_http_client:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1 version: ^2.0.1
wyatt_type_utils: wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.5 version: ^0.1.0+1
dev_dependencies: dev_dependencies:
build_runner: ^2.3.2 build_runner: ^2.3.2
flutter_test: { sdk: flutter } flutter_test: { sdk: flutter }
freezed: ^2.2.1 freezed: ^3.0.0-0.0.dev
hive_generator: ^2.0.0 hive_generator: ^2.0.0
json_serializable: ^6.5.4 json_serializable: ^6.5.4
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.5.0 version: ^2.7.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@@ -15,3 +15,5 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'exceptions/exceptions.dart'; export 'exceptions/exceptions.dart';
export 'extensions/object_extension.dart';
export 'mixins/observers.dart';
@@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
/// {@template app_exception} /// {@template app_exception}
/// [AppException] is a base class for all exceptions in the wyatt architecture. /// [AppException] is a base class for all exceptions in the wyatt architecture.
/// {@endtemplate} /// {@endtemplate}
@@ -27,7 +25,7 @@ abstract class AppException implements Exception {
@override @override
String toString() { String toString() {
if (message.isNotNullOrEmpty) { if (message?.isNotEmpty ?? false) {
return '$runtimeType: $message'; return '$runtimeType: $message';
} else { } else {
return '$runtimeType: An exception occured'; return '$runtimeType: An exception occured';
@@ -0,0 +1,23 @@
// Copyright (C) 2024 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
extension ObjectExtension on Object? {
AppException toException() => this is AppException
? this! as AppException
: ClientException(this?.toString());
}
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2024 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -16,30 +16,26 @@
import 'dart:async'; import 'dart:async';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
import 'package:wyatt_architecture/src/domain/usecase.dart';
/// Usecase observers /// Usecase observers
mixin Observer<Parameters, ReturnType> { mixin Observer<I, O> {
/// Called before usecase is runned. /// Called before usecase is runned.
/// Useful to check the preconditions /// Useful to check the preconditions
FutureOr<void> onStart(Parameters? params) {} FutureOr<void> onStart(I? params) {}
/// Called when error occures during main scenario
/// Useful to run alternative scenario
FutureOr<void> onError(AppException? error) {}
} }
/// Specific observer for classic usecase /// Exception observer
mixin AsyncObserver<ReturnType> { mixin ExceptionObserver<O> {
/// Called when usecase is completed /// Called on error
FutureOr<void> onComplete(ReturnType? data) {} /// Useful to handle exceptions
FutureOr<void> onError(AppException e) {}
} }
/// Specific observer for stream case usecase /// Completer observer
mixin StreamObserver<ReturnType> { mixin CompleterObserver<O> {
/// Replaces the data event handler of this subscription. /// Called after usecase is runned.
void onDone() {} /// Useful to log the result
FutureOr<void> onComplete(Res<O>? result) {}
/// Replaces the done event handler of this subscription.
void onData(ReturnType? data) {}
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2024 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2024 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'data_sources/data_sources.dart'; export 'base_repository.dart';
export 'entities/entities.dart'; export 'entity.dart';
export 'repositories/repositories.dart'; export 'usecase.dart';
export 'usecases/usecases.dart';
@@ -0,0 +1,153 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:generic_usecase/generic_usecase.dart' as generic;
import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
import 'package:wyatt_architecture/src/core/extensions/object_extension.dart';
import 'package:wyatt_architecture/src/core/mixins/observers.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
typedef Res<T> = Result<T, AppException>;
typedef FutureOrResult<T> = FutureOr<Res<T>>;
typedef StreamResult<T> = Stream<Res<T>>;
/// A wrapper around [Result] to make it easier to use with AppException.
Future<Res<T>> unsafe<T>(FutureOr<T> Function() fn) =>
Result.tryCatchAsync<T, AppException, Object>(
() => Future.sync(fn),
(e) => e.toException(),
);
abstract class AsyncUseCase<I, O> extends generic.Usecase<I, Res<O>>
with Observer<I, O>, ExceptionObserver<O>, CompleterObserver<O> {
const AsyncUseCase() : super();
@override
FutureOr<generic.ConditionsResult> checkPreconditions(I? params) async {
try {
await onStart(params);
return generic.ConditionsResult(isValid: true);
} catch (e) {
return generic.ConditionsResult(isValid: false, message: e.toString());
}
}
@override
FutureOr<generic.ConditionsResult> checkPostconditions(Res<O>? result) async {
try {
await onComplete(result);
return generic.ConditionsResult(isValid: true);
} catch (e) {
return generic.ConditionsResult(isValid: false, message: e.toString());
}
}
@override
FutureOrResult<O> onException(Object e) async {
final exception = e.toException();
await onError(exception);
return Err(exception);
}
}
abstract class NoParamsAsyncUseCase<O> extends generic.NoParamsUsecase<Res<O>>
with ExceptionObserver<O>, CompleterObserver<O> {
const NoParamsAsyncUseCase() : super();
@override
FutureOr<generic.ConditionsResult> checkPostconditions(Res<O>? result) async {
try {
await onComplete(result);
return generic.ConditionsResult(isValid: true);
} catch (e) {
return generic.ConditionsResult(isValid: false, message: e.toString());
}
}
@override
FutureOrResult<O> onException(Object e) async {
final exception = e.toException();
await onError(exception);
return Err(exception);
}
}
abstract class StreamUseCase<I, O> extends generic.StreamUsecase<I, Res<O>>
with Observer<I, O>, ExceptionObserver<O> {
const StreamUseCase() : super();
@override
FutureOr<generic.ConditionsResult> checkPreconditions(I? params) async {
try {
await onStart(params);
return generic.ConditionsResult(isValid: true);
} catch (e) {
return generic.ConditionsResult(isValid: false, message: e.toString());
}
}
StreamSubscription<Res<O>> listen(
I params,
void Function(Res<O>)? onData, {
Function? onError,
void Function()? onDone,
bool? cancelOnError,
}) =>
super.call(params).listen(
onData,
onError: onError,
onDone: onDone,
cancelOnError: cancelOnError,
);
@override
FutureOrResult<O> onException(Object e) async {
final exception = e.toException();
await onError(exception);
return Err(exception);
}
}
abstract class NoParamsStreamUseCase<O>
extends generic.NoParamsStreamUsecase<Res<O>> with ExceptionObserver<O> {
const NoParamsStreamUseCase() : super();
StreamSubscription<Res<O>> listen(
void Function(Res<O>)? onData, {
Function? onError,
void Function()? onDone,
bool? cancelOnError,
}) =>
super.call().listen(
onData,
onError: onError,
onDone: onDone,
cancelOnError: cancelOnError,
);
@override
FutureOrResult<O> onException(Object e) async {
final exception = e.toException();
await onError(exception);
return Err(exception);
}
}
@@ -1,100 +0,0 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'package:wyatt_architecture/src/core/exceptions/exceptions.dart';
import 'package:wyatt_architecture/src/domain/usecases/observers.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
typedef FutureOrResult<T> = FutureOr<Result<T, AppException>>;
typedef StreamResult<T> = Stream<Result<T, AppException>>;
/// {@template base_usecase}
/// Abstract class of any use case.
/// {@endtemplate}
abstract class BaseUseCase<Parameters, ReturnType> {
/// {@macro base_usecase}
const BaseUseCase();
/// Run use case scenarios
ReturnType call(Parameters parameters);
/// Private function to implement main scenario
/// of your usecase.
ReturnType execute(Parameters params);
}
/// {@template usecase}
/// Abstract class of a use case that deals specifically
/// with the response and its state.
/// {@endtemplate}
abstract class UseCase<Parameters, ReturnType>
extends BaseUseCase<Parameters?, FutureOrResult<ReturnType>>
with Observer<Parameters, ReturnType> {
/// {@macro usecase}
const UseCase();
FutureOr<void> _onSuccess(ReturnType data);
/// Supports the result of the main scenario and integrates
/// some alternative scenarios if necessary.
@override
FutureOrResult<ReturnType> call(Parameters? parameters) async {
try {
await onStart(parameters);
final response = await execute(parameters);
if (response.isErr) {
await onError(response.err);
} else if (response.isOk && response.ok != null) {
await _onSuccess(response.ok as ReturnType);
}
return response;
} catch (e) {
return Err(ClientException(e.toString()));
}
}
}
/// {@template async_usecase}
/// Abtstract classic usecase bases on futures
/// {@endtemplate}
abstract class AsyncUseCase<Parameters, ReturnType>
extends UseCase<Parameters?, ReturnType> with AsyncObserver<ReturnType> {
/// {@macro async_usecase}
const AsyncUseCase();
@override
FutureOr<void> _onSuccess(ReturnType data) => onComplete(data);
}
/// {@template stream_usecase}
/// Abstract specific usecase bases on streams
/// {@endtemplate}
abstract class StreamUseCase<Parameters, ReturnType>
extends UseCase<Parameters?, Stream<ReturnType>>
with StreamObserver<ReturnType> {
/// {@macro stream_usecase}
const StreamUseCase();
@override
FutureOr<void> _onSuccess(Stream<ReturnType> data) {
data.listen(
onData,
onDone: onDone,
);
}
}
@@ -1,19 +0,0 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'no_param.dart';
export 'observers.dart';
export 'usecase.dart';
@@ -15,4 +15,5 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'core/core.dart'; export 'core/core.dart';
export 'data/base_data_source.dart';
export 'domain/domain.dart'; export 'domain/domain.dart';
+5 -4
View File
@@ -17,19 +17,20 @@
name: wyatt_architecture name: wyatt_architecture
description: Wyatt Architecture contains useful classes to help you to create a clean architecture following the Wyatt Architecture principles. description: Wyatt Architecture contains useful classes to help you to create a clean architecture following the Wyatt Architecture principles.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_architecture repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_architecture
version: 0.2.0+1 version: 0.2.0+3
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: "^3.0.0"
dependencies: dependencies:
generic_usecase: ^3.0.0
wyatt_type_utils: wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.0.5 version: ^0.1.0+1
dev_dependencies: dev_dependencies:
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0 version: ^2.7.0
@@ -1,3 +1,18 @@
## 0.6.0+1
- Update a dependency to the latest release.
## 0.6.0
> Note: This release has breaking changes.
- **FIX**(authentication_bloc): upgrade google sign to his major v.
- **FIX**: apply dart format.
- **FIX**: apply dart fix --apply.
- **FIX**(authentication_bloc): go router version refactoring.
- **FIX**: use correct behavior subject for stream session.
- **BREAKING** **FIX**(authentication): use correct usecase and result.
## 0.5.1+3 ## 0.5.1+3
- upgrade deps - upgrade deps
@@ -0,0 +1,32 @@
## 2.0.0
> Note: This release has breaking changes.
- **REFACTOR**(authentication): remove cross package export.
- **REFACTOR**(authentication): use fromFirebaseUser factory to parse user.
- **REFACTOR**(auth): update example with new input builders.
- **FIX**(authentication_bloc): upgrade google sign to his major v.
- **FIX**(authentication_bloc): go router version refactoring.
- **FIX**(authentication): make sur access token is available on every steps.
- **FIX**(authentication): allow email/password validators customization (closes #57).
- **FIX**(auth): fix some bugs to validate publishing.
- **FIX**(auth): update form plugin and fix auth.
- **FIX**(auth): example needs multidex support.
- **FEAT**(authentication): remove session wrapper for AuthenticationSession.
- **FEAT**(authentication): add custom routine, and documentation.
- **FEAT**(authentication): add full event support.
- **FEAT**(authentication): add google sign in in signIn cubit.
- **FEAT**(auth): add reactive repo + extra data + router examples + tests.
- **FEAT**(auth): add google, facebook, apple, twitter login.
- **DOCS**(authentication): update example with multiple data sources.
- **DOCS**(authentication): add full dartdoc.
- **DOCS**(authentication): update example.
- **DOCS**(authentication): update example.
- **DOCS**(auth): add correct header.
- **BREAKING** **FIX**(authentication): use correct usecase and result.
- **BREAKING** **FIX**(authentication): use FutureOrResult extension (close #41).
- **BREAKING** **FIX**(auth): add signInWithEmailAndPassword and signInAnonymously methods in SignInCubit #26.
- **BREAKING** **FEAT**(authentication): add repo in callback usecases (close #55).
- **BREAKING** **FEAT**(auth): use form_bloc package.
- **BREAKING** **FEAT**(authentication): rename package.
@@ -27,34 +27,34 @@ class ExampleAuthenticationCubit extends AuthenticationCubit<int> {
Result<Account, AppException> result) async { Result<Account, AppException> result) async {
debugPrint('onReauthenticate'); debugPrint('onReauthenticate');
return const Ok(1); return Ok(1);
} }
@override @override
FutureOrResult<int?> onRefresh(Result<Account, AppException> result) { FutureOrResult<int?> onRefresh(Result<Account, AppException> result) {
debugPrint('onRefresh'); debugPrint('onRefresh');
return const Ok(1); return Ok(1);
} }
@override @override
FutureOrResult<int?> onSignInFromCache(AuthenticationSession<int> session) { FutureOrResult<int?> onSignInFromCache(AuthenticationSession<int> session) {
debugPrint('onSignInFromCache'); debugPrint('onSignInFromCache');
return const Ok(1); return Ok(1);
} }
@override @override
FutureOrResult<void> onSignOut() { FutureOrResult<void> onSignOut() {
debugPrint('onSignOut'); debugPrint('onSignOut');
return const Ok(null); return Ok(null);
} }
@override @override
FutureOrResult<void> onDelete() { FutureOrResult<void> onDelete() {
debugPrint('onDelete'); debugPrint('onDelete');
return const Ok(null); return Ok(null);
} }
} }
@@ -30,7 +30,7 @@ class ExampleSignInCubit extends SignInCubit<int> {
Result<Account, AppException> result, WyattForm form) { Result<Account, AppException> result, WyattForm form) {
debugPrint('onSignInWithEmailAndPassword: ${result.ok?.accessToken}'); debugPrint('onSignInWithEmailAndPassword: ${result.ok?.accessToken}');
return const Ok(1); return Ok(1);
} }
@override @override
@@ -38,7 +38,7 @@ class ExampleSignInCubit extends SignInCubit<int> {
Result<Account, AppException> result, WyattForm form) { Result<Account, AppException> result, WyattForm form) {
debugPrint('onSignInAnonymously'); debugPrint('onSignInAnonymously');
return const Ok(1); return Ok(1);
} }
@override @override
@@ -46,6 +46,6 @@ class ExampleSignInCubit extends SignInCubit<int> {
Result<Account, AppException> result, WyattForm form) { Result<Account, AppException> result, WyattForm form) {
debugPrint('onSignInWithGoogle'); debugPrint('onSignInWithGoogle');
return const Ok(1); return Ok(1);
} }
} }
@@ -30,6 +30,6 @@ class ExampleSignUpCubit extends SignUpCubit<int> {
Result<Account, AppException> result, WyattForm form) async { Result<Account, AppException> result, WyattForm form) async {
debugPrint('onSignUpWithEmailAndPassword'); debugPrint('onSignUpWithEmailAndPassword');
return const Ok(1); return Ok(1);
} }
} }
@@ -28,7 +28,7 @@ class ExampleEditAccountCubit extends EditAccountCubit<int> {
Result<Account, AppException> result, WyattForm form) async { Result<Account, AppException> result, WyattForm form) async {
debugPrint('onEmailUpdated'); debugPrint('onEmailUpdated');
return const Ok(1); return Ok(1);
} }
@override @override
@@ -36,6 +36,6 @@ class ExampleEditAccountCubit extends EditAccountCubit<int> {
Result<Account, AppException> result, WyattForm form) async { Result<Account, AppException> result, WyattForm form) async {
debugPrint('onPasswordUpdated'); debugPrint('onPasswordUpdated');
return const Ok(1); return Ok(1);
} }
} }
@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 2.0.0
environment: environment:
sdk: ">=2.17.6 <3.0.0" sdk: ">=2.17.6 <3.0.0"
@@ -30,12 +30,12 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
go_router: ^10.1.0 go_router: ^15.1.2
firebase_core: ^2.1.1 firebase_core: ^3.13.1
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
firebase_auth: ^4.2.0 firebase_auth: ^5.5.4
google_sign_in: ^6.1.4 google_sign_in: ^6.1.4
get_it: ^7.2.0 get_it: ^8.0.3
wyatt_authentication_bloc: wyatt_authentication_bloc:
path: "../" path: "../"
@@ -50,7 +50,7 @@ dependencies:
wyatt_type_utils: wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: 0.0.5 version: ^0.1.0+1
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
@@ -65,7 +65,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your # activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint # package. See that file for information about deactivating specific lint
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^2.0.0 flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@@ -20,7 +20,7 @@ import 'package:wyatt_authentication_bloc/src/domain/entities/account.dart';
/// {@template authentication_cache_data_source} /// {@template authentication_cache_data_source}
/// A data source that manages the cache strategy. /// A data source that manages the cache strategy.
/// {@endtemplate} /// {@endtemplate}
abstract class AuthenticationCacheDataSource<Data> extends BaseLocalDataSource { abstract class AuthenticationCacheDataSource<Data> extends BaseDataSource {
/// {@macro authentication_cache_data_source} /// {@macro authentication_cache_data_source}
const AuthenticationCacheDataSource(); const AuthenticationCacheDataSource();
@@ -20,8 +20,7 @@ import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
/// {@template authentication_session_data_source} /// {@template authentication_session_data_source}
/// A data source that manages the current session. /// A data source that manages the current session.
/// {@endtemplate} /// {@endtemplate}
abstract class AuthenticationSessionDataSource<Data> abstract class AuthenticationSessionDataSource<Data> extends BaseDataSource {
extends BaseLocalDataSource {
/// {@macro authentication_session_data_source} /// {@macro authentication_session_data_source}
const AuthenticationSessionDataSource(); const AuthenticationSessionDataSource();
@@ -22,8 +22,7 @@ import 'package:wyatt_authentication_bloc/src/domain/entities/account.dart';
/// It is responsible for all the external communication with the authentication /// It is responsible for all the external communication with the authentication
/// providers. /// providers.
/// {@endtemplate} /// {@endtemplate}
abstract class AuthenticationRemoteDataSource<Data> abstract class AuthenticationRemoteDataSource<Data> extends BaseDataSource {
extends BaseRemoteDataSource {
/// {@macro authentication_remote_data_source} /// {@macro authentication_remote_data_source}
const AuthenticationRemoteDataSource(); const AuthenticationRemoteDataSource();
@@ -43,12 +43,12 @@ class EditAccountCubit<Data> extends BaseEditAccountCubit<Data>
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<Data?> onPasswordUpdated( FutureOrResult<Data?> onPasswordUpdated(
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
} }
@@ -48,19 +48,19 @@ class SignInCubit<Data> extends BaseSignInCubit<Data>
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<Data?> onSignInWithEmailAndPassword( FutureOrResult<Data?> onSignInWithEmailAndPassword(
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<Data?> onSignInWithGoogle( FutureOrResult<Data?> onSignInWithGoogle(
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
} }
@@ -43,5 +43,5 @@ class SignUpCubit<Data> extends BaseSignUpCubit<Data>
Result<Account, AppException> result, Result<Account, AppException> result,
WyattForm form, WyattForm form,
) => ) =>
const Ok(null); Ok(null);
} }
@@ -1,7 +1,7 @@
name: wyatt_authentication_bloc name: wyatt_authentication_bloc
description: Authentication BLoC for Flutter description: Authentication BLoC for Flutter
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_authentication_bloc repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_authentication_bloc
version: 0.5.1+3 version: 0.6.0+1
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -12,31 +12,31 @@ environment:
dependencies: dependencies:
flutter: { sdk: flutter } flutter: { sdk: flutter }
crypto: ^3.0.3 crypto: ^3.0.3
flutter_bloc: ^8.1.3 flutter_bloc: ^9.1.1
equatable: ^2.0.5 equatable: ^2.0.5
firebase_auth: ^4.10.1 firebase_auth: ^5.5.4
google_sign_in: ^6.1.5 google_sign_in: ^6.1.5
rxdart: ^0.27.7 rxdart: ^0.28.0
flutter_secure_storage: ^9.0.0 flutter_secure_storage: ^9.0.0
http: ^1.1.0 http: ^1.1.0
wyatt_form_bloc: wyatt_form_bloc:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^0.2.0+4 version: ^0.2.0+6
wyatt_architecture: wyatt_architecture:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^0.2.0+1 version: ^0.2.0+3
wyatt_type_utils: wyatt_type_utils:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^0.0.5 version: ^0.1.0+1
dev_dependencies: dev_dependencies:
flutter_test: { sdk: flutter } flutter_test: { sdk: flutter }
bloc_test: ^9.1.0 bloc_test: ^10.0.0
mocktail: ^1.0.0 mocktail: ^1.0.0
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.5.0 version: ^2.7.0
@@ -30,26 +30,26 @@ class TestAuthenticationCubit extends AuthenticationCubit<int> {
TestAuthenticationCubit({required super.authenticationRepository}); TestAuthenticationCubit({required super.authenticationRepository});
@override @override
FutureOrResult<void> onDelete() async => const Ok(null); FutureOrResult<void> onDelete() async => Ok(null);
@override @override
FutureOrResult<int?> onReauthenticate( FutureOrResult<int?> onReauthenticate(
Result<Account, AppException> result, Result<Account, AppException> result,
) async => ) async =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<int?> onRefresh(Result<Account, AppException> result) async => FutureOrResult<int?> onRefresh(Result<Account, AppException> result) async =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<int?> onSignInFromCache( FutureOrResult<int?> onSignInFromCache(
AuthenticationSession<int> session, AuthenticationSession<int> session,
) async => ) async =>
const Ok(null); Ok(null);
@override @override
FutureOrResult<void> onSignOut() async => const Ok(null); FutureOrResult<void> onSignOut() async => Ok(null);
} }
void main() { void main() {
@@ -92,7 +92,7 @@ void main() {
build: () => TestAuthenticationCubit( build: () => TestAuthenticationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const AuthenticationState.unknown(), seed: AuthenticationState.unknown,
expect: () => [AuthenticationState<int>.authenticated(session)], expect: () => [AuthenticationState<int>.authenticated(session)],
); );
@@ -108,7 +108,7 @@ void main() {
build: () => TestAuthenticationCubit( build: () => TestAuthenticationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const AuthenticationState.unknown(), seed: AuthenticationState.unknown,
expect: () => [const AuthenticationState<int>.unauthenticated()], expect: () => [const AuthenticationState<int>.unauthenticated()],
); );
}); });
@@ -119,7 +119,7 @@ void main() {
setUp: () { setUp: () {
when( when(
() => authenticationRepository.signOut(), () => authenticationRepository.signOut(),
).thenAnswer((_) async => const Ok(null)); ).thenAnswer((_) async => Ok(null));
}, },
build: () => TestAuthenticationCubit( build: () => TestAuthenticationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
@@ -84,7 +84,7 @@ void main() {
'invokes sendEmailVerification,', 'invokes sendEmailVerification,',
setUp: () { setUp: () {
when(() => authenticationRepository.sendEmailVerification()) when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Ok(null)); .thenAnswer((_) async => Ok(null));
}, },
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
@@ -100,12 +100,12 @@ void main() {
'emits success', 'emits success',
setUp: () { setUp: () {
when(() => authenticationRepository.sendEmailVerification()) when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Ok(null)); .thenAnswer((_) async => Ok(null));
}, },
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const EmailVerificationState(), seed: EmailVerificationState.new,
act: (cubit) => cubit.sendEmailVerification(), act: (cubit) => cubit.sendEmailVerification(),
expect: () => [ expect: () => [
const EmailVerificationState( const EmailVerificationState(
@@ -121,12 +121,12 @@ void main() {
'emits failure', 'emits failure',
setUp: () { setUp: () {
when(() => authenticationRepository.sendEmailVerification()) when(() => authenticationRepository.sendEmailVerification())
.thenAnswer((_) async => const Err(ServerException('erreur'))); .thenAnswer((_) async => Err(const ServerException('erreur')));
}, },
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const EmailVerificationState(), seed: EmailVerificationState.new,
act: (cubit) => cubit.sendEmailVerification(), act: (cubit) => cubit.sendEmailVerification(),
expect: () => [ expect: () => [
const EmailVerificationState( const EmailVerificationState(
@@ -183,7 +183,7 @@ void main() {
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const EmailVerificationState(), seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(), act: (cubit) => cubit.checkEmailVerification(),
expect: () => [ expect: () => [
const EmailVerificationState( const EmailVerificationState(
@@ -206,7 +206,7 @@ void main() {
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const EmailVerificationState(), seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(), act: (cubit) => cubit.checkEmailVerification(),
expect: () => [ expect: () => [
const EmailVerificationState( const EmailVerificationState(
@@ -222,12 +222,12 @@ void main() {
'emits failure on refresh error', 'emits failure on refresh error',
setUp: () { setUp: () {
when(() => authenticationRepository.refresh()) when(() => authenticationRepository.refresh())
.thenAnswer((_) async => const Err(ServerException('erreur'))); .thenAnswer((_) async => Err(const ServerException('erreur')));
}, },
build: () => EmailVerificationCubit( build: () => EmailVerificationCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
seed: () => const EmailVerificationState(), seed: EmailVerificationState.new,
act: (cubit) => cubit.checkEmailVerification(), act: (cubit) => cubit.checkEmailVerification(),
expect: () => [ expect: () => [
const EmailVerificationState( const EmailVerificationState(
@@ -57,7 +57,7 @@ void main() {
() => authenticationRepository.sendPasswordResetEmail( () => authenticationRepository.sendPasswordResetEmail(
email: any(named: 'email'), email: any(named: 'email'),
), ),
).thenAnswer((_) async => const Ok(null)); ).thenAnswer((_) async => Ok(null));
when( when(
() => authenticationRepository.formRepository, () => authenticationRepository.formRepository,
@@ -157,7 +157,7 @@ void main() {
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
), ),
act: (cubit) => cubit.submit(), act: (cubit) => cubit.submit(),
expect: () => const <PasswordResetState>[], expect: () => <PasswordResetState>[],
); );
blocTest<PasswordResetCubit<int>, PasswordResetState>( blocTest<PasswordResetCubit<int>, PasswordResetState>(
@@ -272,7 +272,7 @@ void main() {
() => authenticationRepository.sendPasswordResetEmail( () => authenticationRepository.sendPasswordResetEmail(
email: any(named: 'email'), email: any(named: 'email'),
), ),
).thenAnswer((_) async => const Err(ServerException())); ).thenAnswer((_) async => Err(const ServerException()));
when( when(
() => formRepository.accessForm(AuthFormName.passwordResetForm), () => formRepository.accessForm(AuthFormName.passwordResetForm),
).thenAnswer( ).thenAnswer(
@@ -435,7 +435,7 @@ void main() {
email: any(named: 'email'), email: any(named: 'email'),
password: any(named: 'password'), password: any(named: 'password'),
), ),
).thenAnswer((_) async => const Err(ServerException())); ).thenAnswer((_) async => Err(const ServerException()));
when( when(
() => formRepository.accessForm(AuthFormName.signInForm), () => formRepository.accessForm(AuthFormName.signInForm),
).thenAnswer( ).thenAnswer(
@@ -615,7 +615,7 @@ void main() {
setUp: () { setUp: () {
when( when(
() => authenticationRepository.signInAnonymously(), () => authenticationRepository.signInAnonymously(),
).thenAnswer((_) async => const Err(ServerException())); ).thenAnswer((_) async => Err(const ServerException()));
}, },
build: () => SignInCubit( build: () => SignInCubit(
authenticationRepository: authenticationRepository, authenticationRepository: authenticationRepository,
@@ -406,7 +406,7 @@ void main() {
email: any(named: 'email'), email: any(named: 'email'),
password: any(named: 'password'), password: any(named: 'password'),
), ),
).thenAnswer((_) async => const Err(ServerException())); ).thenAnswer((_) async => Err(const ServerException()));
when( when(
() => formRepository.accessForm(AuthFormName.signUpForm), () => formRepository.accessForm(AuthFormName.signUpForm),
).thenAnswer( ).thenAnswer(
+6
View File
@@ -1,3 +1,9 @@
## 2.0.3
## 2.0.2
- **FIX**: compilation issue with flutter 3.16.0 and generics name.
## 2.0.1 ## 2.0.1
- **REFACTOR**: docs + nullable multiprovider attributes. - **REFACTOR**: docs + nullable multiprovider attributes.
+1 -1
View File
@@ -1,5 +1,5 @@
<!-- <!--
* Copyright (C) 2022 WYATT GROUP * Copyright (C) 2023 WYATT GROUP
* Please see the AUTHORS file for details. * Please see the AUTHORS file for details.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -0,0 +1,7 @@
## 1.1.0
- **FIX**: compilation issue with flutter 3.16.0 and generics name.
- **FEAT**(bloc): add a lot of docs, fix `onWrap`, and add repo provider.
- **FEAT**(bloc): add provider, consumer and helpers.
- **DOCS**(bloc): add ios example.
@@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -15,10 +15,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 1.1.0
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: ">=3.0.0 <4.0.0"
# Dependencies specify other packages that your package needs in order to work. # Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions # To automatically upgrade your package dependencies to the latest versions
@@ -35,7 +35,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.5 cupertino_icons: ^1.0.5
equatable: ^2.0.5 equatable: ^2.0.5
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
wyatt_bloc_helper: wyatt_bloc_helper:
path: ../ path: ../
@@ -49,7 +49,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your # activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint # package. See that file for information about deactivating specific lint
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^2.0.1 flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
+18 -18
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -24,10 +24,10 @@ import 'package:wyatt_bloc_helper/src/mixins/repository_base_provider_mixin.dart
/// {@template bloc_provider} /// {@template bloc_provider}
/// Need to implement a [create] function that is responsible for /// Need to implement a [create] function that is responsible for
/// creating the [Bloc] and a [builder] which will return a child /// creating the bloc [B] and a [builder] which will return a child
/// that have access to the instance via `context.read<Bloc>()`. /// that have access to the instance via `context.read<Bloc>()`.
/// It is used as a dependency injection (DI) widget so that a single instance /// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Bloc] can be provided to multiple widgets within a subtree. /// of a bloc [B] can be provided to multiple widgets within a subtree.
/// ///
/// It automatically handles closing the instance when used with [create]. /// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed. /// By default, [create] is called only when the instance is accessed.
@@ -36,12 +36,12 @@ import 'package:wyatt_bloc_helper/src/mixins/repository_base_provider_mixin.dart
/// By default, it provide already provided instance found in the tree. /// By default, it provide already provided instance found in the tree.
/// To override this behavior, set [smart] to `false`. /// To override this behavior, set [smart] to `false`.
/// {@endtemplate} /// {@endtemplate}
abstract class BlocProviderScreen<Bloc extends blocbase.Bloc<Event, State>, abstract class BlocProviderScreen<B extends blocbase.Bloc<E, S>, E,
Event, State extends Object> extends BlocBaseProviderScreen<Bloc, State> S extends Object> extends BlocBaseProviderScreen<B, S>
with with
BlocBaseProviderMixin<Bloc>, BlocBaseProviderMixin<B>,
RepositoryProviderMixin, RepositoryProviderMixin,
BlocProviderMixin<Bloc, Event> { BlocProviderMixin<B, E> {
/// {@macro bloc_provider} /// {@macro bloc_provider}
const BlocProviderScreen({super.key, super.lazy = true, super.smart = true}); const BlocProviderScreen({super.key, super.lazy = true, super.smart = true});
} }
@@ -53,11 +53,11 @@ abstract class BlocProviderScreen<Bloc extends blocbase.Bloc<Event, State>,
/// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented /// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented
/// for more granular control over when [onListen] and [onBuild] are called. /// for more granular control over when [onListen] and [onBuild] are called.
/// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on /// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on
/// each [Bloc] or `state` change. /// each bloc [B] or `state` change.
/// They each take the previous `state` and current `state` and must return /// They each take the previous `state` and current `state` and must return
/// a [bool] which determines whether or not the [onBuild] and/or [onListen] /// a [bool] which determines whether or not the [onBuild] and/or [onListen]
/// function will be invoked. /// function will be invoked.
/// The previous `state` will be initialized to the `state` of the [Bloc] when /// The previous `state` will be initialized to the `state` of the bloc [B] when
/// the BlocConsumer is initialized. /// the BlocConsumer is initialized.
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
/// aren't implemented, they will default to `true`. /// aren't implemented, they will default to `true`.
@@ -65,28 +65,28 @@ abstract class BlocProviderScreen<Bloc extends blocbase.Bloc<Event, State>,
/// An optional [parent] can also be implemented. This build a wrapper arround /// An optional [parent] can also be implemented. This build a wrapper arround
/// the built BlocConsumer that is **not** rebuild on each state. /// the built BlocConsumer that is **not** rebuild on each state.
/// {@endtemplate} /// {@endtemplate}
abstract class BlocConsumerScreen<Bloc extends blocbase.Bloc<Event, State>, abstract class BlocConsumerScreen<B extends blocbase.Bloc<E, S>, E,
Event, State extends Object> extends BlocBaseConsumerScreen<Bloc, State> S extends Object> extends BlocBaseConsumerScreen<B, S>
with with
BlocBaseProviderMixin<Bloc>, BlocBaseProviderMixin<B>,
RepositoryProviderMixin, RepositoryProviderMixin,
BlocProviderMixin<Bloc, Event> { BlocProviderMixin<B, E> {
/// {@macro bloc_consumer} /// {@macro bloc_consumer}
const BlocConsumerScreen({super.key}); const BlocConsumerScreen({super.key});
} }
/// {@template bloc_screen} /// {@template bloc_screen}
/// Provide AND access to a [Bloc]. /// Provide AND access to a bloc [B].
/// ///
/// This extends [BlocConsumerScreen] with the methods /// This extends [BlocConsumerScreen] with the methods
/// of [BlocBaseScreen]. /// of [BlocBaseScreen].
/// {@endtemplate} /// {@endtemplate}
abstract class BlocScreen<Bloc extends blocbase.Bloc<Event, State>, Event, abstract class BlocScreen<B extends blocbase.Bloc<E, S>, E, S extends Object>
State extends Object> extends BlocBaseScreen<Bloc, State> extends BlocBaseScreen<B, S>
with with
BlocBaseProviderMixin<Bloc>, BlocBaseProviderMixin<B>,
RepositoryProviderMixin, RepositoryProviderMixin,
BlocProviderMixin<Bloc, Event> { BlocProviderMixin<B, E> {
/// {@macro bloc_screen} /// {@macro bloc_screen}
const BlocScreen({super.key, super.lazy = true, super.smart = true}); const BlocScreen({super.key, super.lazy = true, super.smart = true});
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -24,11 +24,11 @@ import 'package:flutter_bloc/flutter_bloc.dart';
/// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented /// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented
/// for more granular control over when [onListen] and [onBuild] are called. /// for more granular control over when [onListen] and [onBuild] are called.
/// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on /// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on
/// each [Bloc] or `state` change. /// each bloc [B] or `state` change.
/// They each take the previous `state` and current `state` and must return /// They each take the previous `state` and current `state` and must return
/// a [bool] which determines whether or not the [onBuild] and/or [onListen] /// a [bool] which determines whether or not the [onBuild] and/or [onListen]
/// function will be invoked. /// function will be invoked.
/// The previous `state` will be initialized to the `state` of the [Bloc] when /// The previous `state` will be initialized to the `state` of the bloc [B] when
/// the [BlocConsumer] is initialized. /// the [BlocConsumer] is initialized.
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
/// aren't implemented, they will default to `true`. /// aren't implemented, they will default to `true`.
@@ -36,39 +36,39 @@ import 'package:flutter_bloc/flutter_bloc.dart';
/// An optional [parent] can also be implemented. This build a wrapper arround /// An optional [parent] can also be implemented. This build a wrapper arround
/// the built [BlocConsumer] that is **not** rebuild on each state. /// the built [BlocConsumer] that is **not** rebuild on each state.
/// {@endtemplate} /// {@endtemplate}
abstract class BlocBaseConsumerScreen<Bloc extends BlocBase<State>, abstract class BlocBaseConsumerScreen<B extends BlocBase<S>, S extends Object>
State extends Object> extends StatelessWidget { extends StatelessWidget {
/// {@macro bloc_base_consumer} /// {@macro bloc_base_consumer}
const BlocBaseConsumerScreen({super.key}); const BlocBaseConsumerScreen({super.key});
/// Takes the previous `state` and the current `state` and is responsible for /// Takes the previous `state` and the current `state` and is responsible for
/// returning a [bool] which determines whether or not to trigger /// returning a [bool] which determines whether or not to trigger
/// [onBuild] with the current `state`. /// [onBuild] with the current `state`.
bool shouldBuildWhen(State previous, State current) => true; bool shouldBuildWhen(S previous, S current) => true;
/// Takes the previous `state` and the current `state` and is responsible for /// Takes the previous `state` and the current `state` and is responsible for
/// returning a [bool] which determines whether or not to trigger /// returning a [bool] which determines whether or not to trigger
/// [onListen] with the current `state`. /// [onListen] with the current `state`.
bool shouldListenWhen(State previous, State current) => true; bool shouldListenWhen(S previous, S current) => true;
/// The [parent] function which will be invoked on build. /// The [parent] function which will be invoked on build.
/// The [parent] takes a `BuildContext` that **doesn't have** access /// The [parent] takes a `BuildContext` that **doesn't have** access
/// to the [Bloc] or [Cubit]. /// to the bloc [B] or [Cubit].
Widget parent(BuildContext context, Widget child) => child; Widget parent(BuildContext context, Widget child) => child;
/// The [onBuild] function which will be invoked on each widget build. /// The [onBuild] function which will be invoked on each widget build.
/// The [onBuild] takes the `BuildContext` and current `state` and /// The [onBuild] takes the `BuildContext` and current `state` and
/// must return a widget. /// must return a widget.
Widget onBuild(BuildContext context, State state); Widget onBuild(BuildContext context, S state) => const SizedBox.shrink();
/// Takes the `BuildContext` along with the `state` /// Takes the `BuildContext` along with the `state`
/// and is responsible for executing in response to `state` changes. /// and is responsible for executing in response to `state` changes.
void onListen(BuildContext context, State state) {} void onListen(BuildContext context, S state) {}
@override @override
Widget build(BuildContext context) => parent( Widget build(BuildContext context) => parent(
context, context,
BlocConsumer<Bloc, State>( BlocConsumer<B, S>(
listenWhen: shouldListenWhen, listenWhen: shouldListenWhen,
listener: onListen, listener: onListen,
buildWhen: shouldBuildWhen, buildWhen: shouldBuildWhen,
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -20,10 +20,10 @@ import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart';
/// {@template bloc_base_provider} /// {@template bloc_base_provider}
/// Need to implement a [create] function that is responsible for /// Need to implement a [create] function that is responsible for
/// creating the [Bloc] or [Cubit] and a [builder] which will return a child /// creating the bloc or cubit [B] and a [builder] which will return a child
/// that have access to the instance via `context.read<Bloc>()`. /// that have access to the instance via `context.read<Bloc>()`.
/// It is used as a dependency injection (DI) widget so that a single instance /// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Bloc] or [Cubit] can be provided to multiple widgets within a subtree. /// of a bloc or cubit [B] can be provided to multiple widgets within a subtree.
/// ///
/// It automatically handles closing the instance when used with [create]. /// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed. /// By default, [create] is called only when the instance is accessed.
@@ -32,8 +32,8 @@ import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart';
/// By default, it provide already provided instance found in the tree. /// By default, it provide already provided instance found in the tree.
/// To override this behavior, set [smart] to `false`. /// To override this behavior, set [smart] to `false`.
/// {@endtemplate} /// {@endtemplate}
abstract class BlocBaseProviderScreen<Bloc extends BlocBase<State>, abstract class BlocBaseProviderScreen<B extends BlocBase<S>, S extends Object>
State extends Object> extends StatelessWidget { extends StatelessWidget {
/// {@macro bloc_base_provider} /// {@macro bloc_base_provider}
const BlocBaseProviderScreen({ const BlocBaseProviderScreen({
super.key, super.key,
@@ -41,32 +41,32 @@ abstract class BlocBaseProviderScreen<Bloc extends BlocBase<State>,
this.smart = true, this.smart = true,
}); });
/// Whether the [Bloc] or [Cubit] should be created lazily. /// Whether the bloc or cubit [B] should be created lazily.
/// Defaults to `true` which means the [Bloc] or [Cubit] is created only when /// Defaults to `true` which means the bloc or cubit [B] is created only when
/// accessed the first time, not when provided. /// accessed the first time, not when provided.
final bool lazy; final bool lazy;
/// Whether this uses [SmartProvider]. /// Whether this uses [SmartProvider].
/// Defaults to `true`. But if you want to provide new [Bloc] or [Cubit] /// Defaults to `true`. But if you want to provide new bloc or cubit [B]
/// of a same type in a sub-tree you may have to disable this. /// of a same type in a sub-tree you may have to disable this.
final bool smart; final bool smart;
/// Creates the [Bloc] or [Cubit] to be used. /// Creates the bloc or cubit [B] to be used.
Bloc create(BuildContext context); B create(BuildContext context);
/// Initialize the [Bloc] or [Cubit]. /// Initialize the bloc or cubit [B].
/// ///
/// This function is useful when using with [SmartProvider], because /// This function is useful when using with [SmartProvider], because
/// if you want to pass an initial event to your bloc you can pass it in /// if you want to pass an initial event to your bloc you can pass it in
/// `create` function but if you re-use the bloc below in the tree this event /// `create` function but if you re-use the bloc below in the tree this event
/// will never be re-pass. /// will never be re-pass.
Bloc init(BuildContext context, Bloc bloc) => bloc; B init(BuildContext context, B bloc) => bloc;
/// Creates the child [Widget] to be used. /// Creates the child [Widget] to be used.
Widget builder(BuildContext context); Widget builder(BuildContext context);
@override @override
Widget build(BuildContext context) => SmartProvider.bloc<Bloc, State>( Widget build(BuildContext context) => SmartProvider.bloc<B, S>(
context, context,
lazy: lazy, lazy: lazy,
enable: smart, enable: smart,
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -20,14 +20,14 @@ import 'package:wyatt_bloc_helper/src/bloc_base/bloc_base_consumer_screen.dart';
import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart'; import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart';
/// {@template bloc_base_screen} /// {@template bloc_base_screen}
/// Provide AND access to a [Bloc] or [Cubit]. /// Provide AND access to a bloc or cubit [B].
/// ///
/// This extends [BlocBaseConsumerScreen] with the methods /// This extends [BlocBaseConsumerScreen] with the methods
// ignore: comment_references // ignore: comment_references
/// of [BlocBaseProviderScreen]. /// of [BlocBaseProviderScreen].
/// {@endtemplate} /// {@endtemplate}
abstract class BlocBaseScreen<Bloc extends BlocBase<State>, abstract class BlocBaseScreen<B extends BlocBase<S>, S extends Object>
State extends Object> extends BlocBaseConsumerScreen<Bloc, State> { extends BlocBaseConsumerScreen<B, S> {
/// {@macro bloc_base_screen} /// {@macro bloc_base_screen}
const BlocBaseScreen({ const BlocBaseScreen({
super.key, super.key,
@@ -35,8 +35,8 @@ abstract class BlocBaseScreen<Bloc extends BlocBase<State>,
this.smart = true, this.smart = true,
}); });
/// Whether the [Bloc] or [Cubit] should be created lazily. /// Whether the bloc or cubit [B] should be created lazily.
/// Defaults to `true` which means the [Bloc] is created only when /// Defaults to `true` which means the bloc is created only when
/// accessed the first time, not when provided. /// accessed the first time, not when provided.
final bool lazy; final bool lazy;
@@ -45,19 +45,19 @@ abstract class BlocBaseScreen<Bloc extends BlocBase<State>,
/// in a sub-tree you may have to disable this. /// in a sub-tree you may have to disable this.
final bool smart; final bool smart;
/// Creates the [Cubit] or [Bloc] to be used. /// Creates the cubit or bloc to be used.
Bloc create(BuildContext context); B create(BuildContext context);
/// Initialize the [Bloc] or [Cubit]. /// Initialize the bloc or cubit [B].
/// ///
/// This function is useful when using with [SmartProvider], because /// This function is useful when using with [SmartProvider], because
/// if you want to pass an initial event to your bloc you can pass it in /// if you want to pass an initial event to your bloc you can pass it in
/// `create` function but if you re-use the bloc below in the tree this event /// `create` function but if you re-use the bloc below in the tree this event
/// will never be re-pass. /// will never be re-pass.
Bloc init(BuildContext context, Bloc bloc) => bloc; B init(BuildContext context, B bloc) => bloc;
@override @override
Widget build(BuildContext context) => SmartProvider.bloc<Bloc, State>( Widget build(BuildContext context) => SmartProvider.bloc<B, S>(
context, context,
lazy: lazy, lazy: lazy,
enable: smart, enable: smart,
+16 -16
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -23,10 +23,10 @@ import 'package:wyatt_bloc_helper/src/mixins/repository_base_provider_mixin.dart
/// {@template cubit_provider} /// {@template cubit_provider}
/// Need to implement a [create] function that is responsible for /// Need to implement a [create] function that is responsible for
/// creating the [Cubit] and a [builder] which will return a child /// creating the cubit [C] and a [builder] which will return a child
/// that have access to the instance via `context.read<Cubit>()`. /// that have access to the instance via `context.read<Cubit>()`.
/// It is used as a dependency injection (DI) widget so that a single instance /// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Cubit] can be provided to multiple widgets within a subtree. /// of a cubit [C] can be provided to multiple widgets within a subtree.
/// ///
/// It automatically handles closing the instance when used with [create]. /// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed. /// By default, [create] is called only when the instance is accessed.
@@ -35,9 +35,9 @@ import 'package:wyatt_bloc_helper/src/mixins/repository_base_provider_mixin.dart
/// By default, it provide already provided instance in found in the tree. /// By default, it provide already provided instance in found in the tree.
/// To override this behavior, set [smart] to `false`. /// To override this behavior, set [smart] to `false`.
/// {@endtemplate} /// {@endtemplate}
abstract class CubitProviderScreen<Cubit extends blocbase.Cubit<State>, abstract class CubitProviderScreen<C extends blocbase.Cubit<S>,
State extends Object> extends BlocBaseProviderScreen<Cubit, State> S extends Object> extends BlocBaseProviderScreen<C, S>
with BlocBaseProviderMixin<Cubit>, RepositoryProviderMixin { with BlocBaseProviderMixin<C>, RepositoryProviderMixin {
/// {@macro cubit_provider} /// {@macro cubit_provider}
const CubitProviderScreen({super.key, super.lazy = true, super.smart = true}); const CubitProviderScreen({super.key, super.lazy = true, super.smart = true});
} }
@@ -49,35 +49,35 @@ abstract class CubitProviderScreen<Cubit extends blocbase.Cubit<State>,
/// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented /// An optional [shouldBuildWhen] and [shouldListenWhen] can be implemented
/// for more granular control over when [onListen] and [onBuild] are called. /// for more granular control over when [onListen] and [onBuild] are called.
/// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on /// The [shouldListenWhen] and [shouldBuildWhen] will be invoked on
/// each [Cubit] or `state` change. /// each cubit [C] or `state` change.
/// They each take the previous `state` and current `state` and must return /// They each take the previous `state` and current `state` and must return
/// a [bool] which determines whether or not the [onBuild] and/or [onListen] /// a [bool] which determines whether or not the [onBuild] and/or [onListen]
/// function will be invoked. /// function will be invoked.
/// The previous `state` will be initialized to the `state` of the [Cubit] when /// The previous `state` will be initialized to the `state` of the cubit [C]
/// the BlocConsumer is initialized. /// when the BlocConsumer is initialized.
/// [shouldListenWhen] and [shouldBuildWhen] are optional and if they /// [shouldListenWhen] and [shouldBuildWhen] are optional and if they
/// aren't implemented, they will default to `true`. /// aren't implemented, they will default to `true`.
/// ///
/// An optional [parent] can also be implemented. This build a wrapper arround /// An optional [parent] can also be implemented. This build a wrapper arround
/// the built BlocConsumer that is **not** rebuild on each state. /// the built BlocConsumer that is **not** rebuild on each state.
/// {@endtemplate} /// {@endtemplate}
abstract class CubitConsumerScreen<Cubit extends blocbase.Cubit<State>, abstract class CubitConsumerScreen<C extends blocbase.Cubit<S>,
State extends Object> extends BlocBaseConsumerScreen<Cubit, State> S extends Object> extends BlocBaseConsumerScreen<C, S>
with BlocBaseProviderMixin<Cubit>, RepositoryProviderMixin { with BlocBaseProviderMixin<C>, RepositoryProviderMixin {
/// {@macro cubit_consumer} /// {@macro cubit_consumer}
const CubitConsumerScreen({super.key}); const CubitConsumerScreen({super.key});
} }
/// {@template cubit_screen} /// {@template cubit_screen}
/// Provide AND access to a [Cubit]. /// Provide AND access to a cubit [C].
/// ///
/// This extends [CubitConsumerScreen] with the methods /// This extends [CubitConsumerScreen] with the methods
// ignore: comment_references // ignore: comment_references
/// of [CubitProviderScreen]. /// of [CubitProviderScreen].
/// {@endtemplate} /// {@endtemplate}
abstract class CubitScreen<Cubit extends blocbase.Cubit<State>, abstract class CubitScreen<C extends blocbase.Cubit<S>, S extends Object>
State extends Object> extends BlocBaseScreen<Cubit, State> extends BlocBaseScreen<C, S>
with BlocBaseProviderMixin<Cubit>, RepositoryProviderMixin { with BlocBaseProviderMixin<C>, RepositoryProviderMixin {
/// {@macro cubit_screen} /// {@macro cubit_screen}
const CubitScreen({super.key, super.lazy = true, super.smart = true}); const CubitScreen({super.key, super.lazy = true, super.smart = true});
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -18,10 +18,10 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
/// A mixin that provides implementation of helper methods for /// A mixin that provides implementation of helper methods for
/// [Bloc] and [Cubit] widgets. /// bloc and cubit [B] widgets.
mixin BlocBaseProviderMixin<Bloc extends BlocBase<Object>> { mixin BlocBaseProviderMixin<B extends BlocBase<Object>> {
/// Returns the [BlocBase] used by this [BlocBaseProviderMixin]. /// Returns the [BlocBase] used by this [BlocBaseProviderMixin].
Bloc bloc(BuildContext context) => context.read<Bloc>(); B bloc(BuildContext context) => context.read<B>();
/// Returns another [BlocBase] **not** used by this [BlocBaseProviderMixin]. /// Returns another [BlocBase] **not** used by this [BlocBaseProviderMixin].
/// Short hand for `context.read<AnotherBloc>();` /// Short hand for `context.read<AnotherBloc>();`
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -17,12 +17,11 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as blocbase; import 'package:flutter_bloc/flutter_bloc.dart' as blocbase;
/// [Bloc] specific mixin that provides implementation /// Bloc [B] specific mixin that provides implementation
/// of helper methods for events. /// of helper methods for events.
mixin BlocProviderMixin<Bloc extends blocbase.Bloc<Event, Object>, Event> { mixin BlocProviderMixin<B extends blocbase.Bloc<E, Object>, E> {
/// Add an event to the [Bloc]. /// Add an event to the [B].
/// ///
/// Short hand for `context.read<Bloc>().add(event)`. /// Short hand for `context.read<Bloc>().add(event)`.
void add(BuildContext context, Event event) => void add(BuildContext context, E event) => context.read<B>().add(event);
context.read<Bloc>().add(event);
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -20,7 +20,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
/// A mixin that provides implementation of helper methods for /// A mixin that provides implementation of helper methods for
/// Repository widgets. /// Repository widgets.
mixin RepositoryProviderMixin { mixin RepositoryProviderMixin {
/// Returns the [Repository] used by this [Widget]. /// Returns the [R] used by this [Widget].
Repository repo<Repository>(BuildContext context) => R repo<R>(BuildContext context) => context.read<R>();
context.read<Repository>();
} }
+6 -6
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -19,10 +19,10 @@ import 'package:wyatt_bloc_helper/src/repository/repository_provider_screen.dart
/// {@template repository_provider} /// {@template repository_provider}
/// Need to implement a [create] function that is responsible for /// Need to implement a [create] function that is responsible for
/// creating the [Repository] and a [builder] which will return a child /// creating the [R] and a [builder] which will return a child
/// that have access to the instance via `context.read<Repository>()`. /// that have access to the instance via `context.read<Repository>()`.
/// It is used as a dependency injection (DI) widget so that a single instance /// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Repository] can be provided to multiple widgets within a subtree. /// of a [R] can be provided to multiple widgets within a subtree.
/// ///
/// It automatically handles closing the instance when used with [create]. /// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed. /// By default, [create] is called only when the instance is accessed.
@@ -31,9 +31,9 @@ import 'package:wyatt_bloc_helper/src/repository/repository_provider_screen.dart
/// By default, it provide already provided instance found in the tree. /// By default, it provide already provided instance found in the tree.
/// To override this behavior, set [smart] to `false`. /// To override this behavior, set [smart] to `false`.
/// {@endtemplate} /// {@endtemplate}
abstract class RepositoryProviderScreen<Repository> abstract class RepositoryProviderScreen<R>
extends RepositoryBaseProviderScreen<Repository> extends RepositoryBaseProviderScreen<R> with RepositoryProviderMixin {
with RepositoryProviderMixin {
/// {@macro repository_provider} /// {@macro repository_provider}
@Deprecated('Useless provider screen. Use get_it instead.')
const RepositoryProviderScreen({super.key}); const RepositoryProviderScreen({super.key});
} }
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -19,10 +19,10 @@ import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart';
/// {@template repository_base_provider} /// {@template repository_base_provider}
/// Need to implement a [create] function that is responsible for /// Need to implement a [create] function that is responsible for
/// creating the [Repository] and a [builder] which will return a child /// creating the [R] and a [builder] which will return a child
/// that have access to the instance via `context.read<Repository>()`. /// that have access to the instance via `context.read<Repository>()`.
/// It is used as a dependency injection (DI) widget so that a single instance /// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Repository] can be provided to multiple widgets within a subtree. /// of a [R] can be provided to multiple widgets within a subtree.
/// ///
/// It automatically handles closing the instance when used with [create]. /// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed. /// By default, [create] is called only when the instance is accessed.
@@ -31,8 +31,7 @@ import 'package:wyatt_bloc_helper/src/utils/smart_provider.dart';
/// By default, it provide already provided instance found in the tree. /// By default, it provide already provided instance found in the tree.
/// To override this behavior, set [smart] to `false`. /// To override this behavior, set [smart] to `false`.
/// {@endtemplate} /// {@endtemplate}
abstract class RepositoryBaseProviderScreen<Repository> abstract class RepositoryBaseProviderScreen<R> extends StatelessWidget {
extends StatelessWidget {
/// {@macro repository_base_provider} /// {@macro repository_base_provider}
const RepositoryBaseProviderScreen({ const RepositoryBaseProviderScreen({
super.key, super.key,
@@ -40,32 +39,32 @@ abstract class RepositoryBaseProviderScreen<Repository>
this.smart = true, this.smart = true,
}); });
/// Whether the [Repository] should be created lazily. /// Whether the [R] should be created lazily.
/// Defaults to `true` which means the [Repository] is created only when /// Defaults to `true` which means the [R] is created only when
/// accessed the first time, not when provided. /// accessed the first time, not when provided.
final bool lazy; final bool lazy;
/// Whether this uses [SmartProvider]. /// Whether this uses [SmartProvider].
/// Defaults to `true`. But if you want to provide new [Repository] of a /// Defaults to `true`. But if you want to provide new [R] of a
/// same type in a sub-tree you may have to disable this. /// same type in a sub-tree you may have to disable this.
final bool smart; final bool smart;
/// Creates the [Repository] to be used. /// Creates the [R] to be used.
Repository create(BuildContext context); R create(BuildContext context);
/// Initialize the [Repository]. /// Initialize the [R].
/// ///
/// This function is useful when using with [SmartProvider], because /// This function is useful when using with [SmartProvider], because
/// if you want to pass an initial call on your repository you can /// if you want to pass an initial call on your repository you can
/// call it in `create` function but if you re-provide the repo below in the /// call it in `create` function but if you re-provide the repo below in the
/// tree this action will never be call again. /// tree this action will never be call again.
Repository init(BuildContext context, Repository repository) => repository; R init(BuildContext context, R repository) => repository;
/// Creates the child [Widget] to be used. /// Creates the child [Widget] to be used.
Widget builder(BuildContext context); Widget builder(BuildContext context);
@override @override
Widget build(BuildContext context) => SmartProvider.repo<Repository>( Widget build(BuildContext context) => SmartProvider.repo<R>(
context, context,
lazy: lazy, lazy: lazy,
enable: smart, enable: smart,
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -18,32 +18,31 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
/// A utility class that provides a way to create a [BlocProvider] or /// A utility class that provides a way to create a [BlocProvider] or
/// [RepositoryProvider] with a [Bloc] or Repository that is already /// [RepositoryProvider] with a bloc or Repository that is already
/// available in the widget tree. /// available in the widget tree.
abstract class SmartProvider { abstract class SmartProvider {
/// Creates a [BlocProvider] with a [Bloc] that is possibly already /// Creates a [BlocProvider] with a bloc [B] that is possibly already
/// available in the widget tree. /// available in the widget tree.
static BlocProvider<Bloc> static BlocProvider<B> bloc<B extends BlocBase<S>, S extends Object>(
bloc<Bloc extends BlocBase<State>, State extends Object>(
BuildContext context, { BuildContext context, {
required Bloc Function(BuildContext) create, required B Function(BuildContext) create,
required Bloc Function(BuildContext, Bloc) init, required B Function(BuildContext, B) init,
Widget? child, Widget? child,
bool lazy = true, bool lazy = true,
bool enable = true, bool enable = true,
}) { }) {
if (enable) { if (enable) {
final bloc = context.read<Bloc?>(); final bloc = context.read<B?>();
if (bloc != null) { if (bloc != null) {
final b = bloc; final b = bloc;
return BlocProvider<Bloc>.value( return BlocProvider<B>.value(
value: init(context, b), value: init(context, b),
child: child, child: child,
); );
} }
} }
return BlocProvider<Bloc>( return BlocProvider<B>(
lazy: lazy, lazy: lazy,
create: (_) => init(context, create(context)), create: (_) => init(context, create(context)),
child: child, child: child,
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
@@ -1,4 +1,4 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
+4 -4
View File
@@ -1,7 +1,7 @@
name: wyatt_bloc_helper name: wyatt_bloc_helper
description: Your best friend for blocs in Flutter description: Your best friend for blocs in Flutter
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_helper repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_helper
version: 2.0.1 version: 2.0.3
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -11,13 +11,13 @@ environment:
dependencies: dependencies:
flutter: { sdk: flutter } flutter: { sdk: flutter }
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
equatable: ^2.0.5 equatable: ^2.0.5
dev_dependencies: dev_dependencies:
flutter_test: { sdk: flutter } flutter_test: { sdk: flutter }
bloc_test: ^9.1.0 bloc_test: ^10.0.0
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0 version: ^2.7.0
+12
View File
@@ -1,3 +1,15 @@
## 0.1.2+7
- Update a dependency to the latest release.
## 0.1.2+6
- Update a dependency to the latest release.
## 0.1.2+5
- Update a dependency to the latest release.
## 0.1.2+4 ## 0.1.2+4
- Update a dependency to the latest release. - Update a dependency to the latest release.
@@ -0,0 +1,17 @@
## 2.0.0
> Note: This release has breaking changes.
- **REFACTOR**(bloc_layouts): refactored block using the ui layout package, due to breaking changes.
- **REFACTOR**(bloc_layout): remove cross package export.
- **REFACTOR**(bloc_layout): migrate bloc layouts using copywith component method (close #121).
- **REFACTOR**(bloc_layout): update example (#92).
- **REFACTOR**(bloc_layout): update example with new app bar entity (#90).
- **FIX**: apply dart fix --apply.
- **FIX**: remove wyatt arch ios example.
- **FIX**(ui): change example to be compatible with new AppTopBar and TextWrapper.
- **FIX**(bloc_layout): fix textwrapper.
- **FEAT**(bloc_layout): rework on structure using new components and layouts.
- **FEAT**(bloc_layout): add new package to combine bloc_helper, crud_bloc, ui_components, and ui_layout.
- **BREAKING** **FEAT**(layout): update layout plugins with new components system.
@@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1 version: 2.0.0
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: ">=2.17.0 <3.0.0"
@@ -32,20 +32,20 @@ dependencies:
wyatt_bloc_layout: wyatt_bloc_layout:
path: "../" path: "../"
flutter_bloc: ^8.1.2 flutter_bloc: ^9.1.1
wyatt_bloc_helper: wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1 version: ^2.0.3
wyatt_ui_layout: wyatt_ui_layout:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.1.2+3 version: ^0.1.3+1
wyatt_crud_bloc: wyatt_crud_bloc:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.2.0 version: ^0.2.0+2
wyatt_ui_components: wyatt_ui_components:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.3.0+2 version: ^0.4.0
wyatt_component_copy_with_extension: wyatt_component_copy_with_extension:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1 version: ^2.0.1
@@ -59,7 +59,7 @@ dev_dependencies:
version: ^2.0.1 version: ^2.0.1
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.5.0 version: ^2.7.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
+6 -6
View File
@@ -1,7 +1,7 @@
name: wyatt_bloc_layout name: wyatt_bloc_layout
description: Layouts based on bloc helper library description: Layouts based on bloc helper library
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_layout repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_layout
version: 0.1.2+4 version: 0.1.2+7
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -11,23 +11,23 @@ environment:
dependencies: dependencies:
flutter: { sdk: flutter } flutter: { sdk: flutter }
flutter_bloc: ^8.1.2 flutter_bloc: ^9.1.1
wyatt_bloc_helper: wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^2.0.1 version: ^2.0.3
wyatt_ui_layout: wyatt_ui_layout:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.1.2+3 version: ^0.1.3
wyatt_crud_bloc: wyatt_crud_bloc:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.2.0 version: ^0.2.0+2
wyatt_ui_components: wyatt_ui_components:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
version: ^0.3.0+2 version: ^0.4.0
dev_dependencies: dev_dependencies:
flutter_test: { sdk: flutter } flutter_test: { sdk: flutter }
@@ -1,3 +1,15 @@
## 0.1.1+5
- Update a dependency to the latest release.
## 0.1.1+4
- **FIX**(notification): port the new usecase syntax.
## 0.1.1+3
- Update a dependency to the latest release.
## 0.1.1+2 ## 0.1.1+2
- **FIX**: apply dart format. - **FIX**: apply dart format.
@@ -0,0 +1,4 @@
## 1.0.1
- **FIX**: apply dart format.
@@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1 version: 1.0.1
environment: environment:
sdk: '>=2.18.2 <3.0.0' sdk: '>=2.18.2 <3.0.0'
@@ -32,7 +32,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
wyatt_cloud_messaging_bloc_base: wyatt_cloud_messaging_bloc_base:
path: ../ path: ../
@@ -40,7 +40,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
firebase_core: ^2.3.0 firebase_core: ^3.13.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -48,7 +48,7 @@ dev_dependencies:
wyatt_analysis: wyatt_analysis:
git: git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.2.2 ref: wyatt_analysis-v2.7.0
path: packages/wyatt_analysis path: packages/wyatt_analysis
# The "flutter_lints" package below contains a set of recommended lints to # The "flutter_lints" package below contains a set of recommended lints to
@@ -56,7 +56,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your # activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint # package. See that file for information about deactivating specific lint
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^2.0.0 flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@@ -17,12 +17,12 @@
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart';
class InitCloudmessagingUseCase extends AsyncUseCase<NoParam, void> { class InitCloudmessagingUseCase extends NoParamsAsyncUseCase<void> {
InitCloudmessagingUseCase({ InitCloudmessagingUseCase({
required CloudMessagingRepository notificationRepository, required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository; }) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository; final CloudMessagingRepository _notificationRepository;
@override @override
FutureOrResult<void> execute(NoParam? params) => FutureOrResult<void> execute() =>
_notificationRepository.init(); _notificationRepository.init();
} }
@@ -24,13 +24,13 @@ import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_me
import 'package:wyatt_type_utils/wyatt_type_utils.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class ListenNotificationUseCase class ListenNotificationUseCase
extends StreamUseCase<NoParam, RemoteNotification> { extends NoParamsAsyncUseCase<Stream<RemoteNotification>> {
ListenNotificationUseCase({ ListenNotificationUseCase({
required CloudMessagingRepository notificationRepository, required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository; }) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository; final CloudMessagingRepository _notificationRepository;
@override @override
FutureOrResult<Stream<RemoteNotification>> execute(NoParam? params) async { FutureOrResult<Stream<RemoteNotification>> execute() async {
Stream<RemoteNotification>? notificationStream; Stream<RemoteNotification>? notificationStream;
final notificationStreamResponse = final notificationStreamResponse =
@@ -66,7 +66,7 @@ class ListenNotificationUseCase
} }
if (notificationStream == null) { if (notificationStream == null) {
return const Err(NotificationException('Cannot listen notifications')); return Err(const NotificationException('Cannot listen notifications'));
} }
return Ok(notificationStream); return Ok(notificationStream);
@@ -18,11 +18,9 @@ import 'dart:async';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/entities/remote_notifications.dart';
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/listen_notification_use_case.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/listen_notification_use_case.dart';
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/subscribe_to_notification_topic_use_case.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/subscribe_to_notification_topic_use_case.dart';
import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart';
part 'cloud_messaging_state.dart'; part 'cloud_messaging_state.dart';
@@ -46,7 +44,7 @@ class CloudMessagingCubit extends Cubit<CloudmessagingState> {
final OnNotification? handleNotification; final OnNotification? handleNotification;
Future<void> listenNotification() async { Future<void> listenNotification() async {
final notificaitons = await _listenNotification.execute(const NoParam()); final notificaitons = await _listenNotification.execute();
if (notificaitons.isOk) { if (notificaitons.isOk) {
notificaitons.ok?.listen((notification) { notificaitons.ok?.listen((notification) {
emit(CloudmessagingState(notification)); emit(CloudmessagingState(notification));
@@ -1,7 +1,7 @@
name: wyatt_cloud_messaging_bloc_base name: wyatt_cloud_messaging_bloc_base
description: A starting point for Dart libraries or applications. description: A starting point for Dart libraries or applications.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_notification_bloc repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_notification_bloc
version: 0.1.1+2 version: 0.1.1+5
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
@@ -12,27 +12,27 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
equatable: ^2.0.5 equatable: ^2.0.5
firebase_messaging: ^14.1.1 firebase_messaging: ^15.2.6
flutter_bloc: ^8.1.1 flutter_bloc: ^9.1.1
rxdart: ^0.27.7 rxdart: ^0.28.0
wyatt_architecture: wyatt_architecture:
hosted: hosted:
url: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ url: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
name: wyatt_architecture name: wyatt_architecture
version: ^0.2.0+1 version: ^0.2.0+3
wyatt_type_utils: wyatt_type_utils:
hosted: hosted:
url: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ url: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
name: wyatt_type_utils name: wyatt_type_utils
version: ^0.0.5 version: ^0.1.0+1
wyatt_bloc_helper: wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1 version: ^2.0.3
dev_dependencies: dev_dependencies:
wyatt_analysis: wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: 2.2.2 version: ^2.7.0
@@ -1,3 +1,15 @@
## 0.1.0+5
- Update a dependency to the latest release.
## 0.1.0+4
- Update a dependency to the latest release.
## 0.1.0+3
- Update a dependency to the latest release.
## 0.1.0+2 ## 0.1.0+2
- **REFACTOR**(cloud_messaging_bloc_firebase): update deps. - **REFACTOR**(cloud_messaging_bloc_firebase): update deps.
@@ -0,0 +1,4 @@
## 1.0.1
- Update a dependency to the latest release.

Some files were not shown because too many files have changed in this diff Show More