Compare commits
175
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f1c93c35f
|
||
|
|
fcc439a311
|
||
|
|
5a3eeed7b5
|
||
|
|
0e5e2403ce
|
||
|
|
76a655ac63
|
||
|
|
b458f8c0c8
|
||
|
|
2e5aafdb5a
|
||
|
|
fdd020f103
|
||
|
|
918215b5b8
|
||
|
|
b68e46c622
|
||
|
|
305cddea19
|
||
|
|
50886d97b3
|
||
|
|
692c255a19
|
||
|
|
4dc0b26e95
|
||
|
|
bf1d8f188f
|
||
|
|
a72babfafe
|
||
|
|
830d32152b
|
||
|
|
7f0544d19c
|
||
|
|
c005c3dc43
|
||
|
|
97c14c7a99
|
||
|
|
f37babc084
|
||
|
|
e6c234f0ea
|
||
|
|
2088e0e4bc
|
||
|
|
1e07b2ed1c
|
||
|
|
9339100399
|
||
|
|
03725c25c7
|
||
|
|
588a09e0a1
|
||
|
|
bd53d11e0d | ||
|
|
ee8f08cc32 | ||
|
|
413589462b | ||
|
|
ff3f2008de | ||
|
|
0b27a62669 | ||
|
|
6c9b6e239b | ||
|
|
576a01512b | ||
|
|
cd3ed0fe69 | ||
|
|
46c51525e8 | ||
|
|
b025247002 | ||
|
|
c70d4c6650 | ||
|
|
04a87fe32a | ||
|
|
f8f367baf6 | ||
|
|
e667aa06d0 | ||
|
|
f6ef5828bb
|
||
|
|
f22ba300cb | ||
|
|
5f52b2fc3d
|
||
|
|
f46707f5c1
|
||
|
|
17ff0f8ba1 | ||
|
|
1a3631f691
|
||
|
|
197c5d54e6
|
||
|
|
c7b241de2d
|
||
|
|
94d573a584
|
||
|
|
37e00fe9c4
|
||
|
|
3c8ff373a1
|
||
|
|
640cfaf118
|
||
|
|
7fc3736854
|
||
|
|
29d8ec640f
|
||
|
|
7f9621b4f6
|
||
|
|
7b61f3f08a
|
||
|
|
75a5facfdc
|
||
|
|
c93b7fb5f7 | ||
|
|
aee7060a0b
|
||
|
|
4f49f4931c | ||
|
|
e8172004a3 | ||
|
|
c6d8ca37fe | ||
|
|
e01f47d41a | ||
|
|
7a24a36af0 | ||
|
|
244a286509 | ||
|
|
81a7ca5a1f | ||
|
|
45c7bd6fca | ||
|
|
cd2806b07b | ||
|
|
dd275460f6 | ||
|
|
dc0f0c61c6 | ||
|
|
1e305c75bd
|
||
|
|
9af76b8e1f | ||
|
|
5593620181 | ||
|
|
a19d4bc5ce | ||
|
|
21b18054ba | ||
|
|
ff90af47cd | ||
|
|
3bb57e65f8 | ||
|
|
9d0aac7894 | ||
|
|
a561cbff23 | ||
|
|
fafec78546 | ||
|
|
feca378131 | ||
|
|
f223811f4b
|
||
|
|
ed65489316
|
||
|
|
33797e4dbf | ||
|
|
3aa6d03dd6 | ||
|
|
bf03324fd0 | ||
|
|
5e83c9e74e
|
||
|
|
672aba7084
|
||
|
|
94d7efbe8c
|
||
|
|
5298bd99ed
|
||
|
|
d792f4cbe9 | ||
|
|
098ec9715e | ||
|
|
6d3c64d17c | ||
|
|
c615186f19 | ||
|
|
55e24fb23b | ||
|
|
4d04c3f446 | ||
|
|
a20e4a1715 | ||
|
|
cf9f1ddb65 | ||
|
|
0c141c715e | ||
|
|
d0f59bbf29 | ||
|
|
562f84dd33 | ||
|
|
771f600eb7 | ||
|
|
7fcb9e8ac3
|
||
|
|
2a4e29f38c
|
||
|
|
ca70f2eb1d
|
||
|
|
f123e537ae
|
||
|
|
c3315d968c | ||
|
|
45312473d1 | ||
|
|
17e7bce9e6 | ||
|
|
3886ef080e
|
||
|
|
626d951443
|
||
|
|
f36e0b51e0
|
||
|
|
80ce7aff91 | ||
|
|
a9121b6862 | ||
|
|
54f92e8042 | ||
|
|
00393a6ba7 | ||
|
|
136e0e8c98 | ||
|
|
500a6ae51d | ||
|
|
79fdde25fc | ||
|
|
742bf1d614 | ||
|
|
0dbde68d7d | ||
|
|
cd881da072 | ||
|
|
5918a5cf1f | ||
|
|
775d766d14 | ||
|
|
383098b147 | ||
|
|
4d51e2b786 | ||
|
|
32cc1f55d9 | ||
|
|
6ee101bf36 | ||
|
|
f0ed08bd49
|
||
|
|
390fb81b1e
|
||
|
|
279d451cd8
|
||
|
|
a66db23ace
|
||
|
|
3d7af98ac9
|
||
|
|
b033b97917 | ||
|
|
14b7f31b53
|
||
|
|
403bcafe93
|
||
|
|
21ab6f6021
|
||
|
|
198ecac5da
|
||
|
|
c945cd435e
|
||
|
|
852d29ef0a
|
||
|
|
08383ec03b
|
||
|
|
ee8ce76839
|
||
|
|
f05f2230e9
|
||
|
|
54002beaab
|
||
|
|
d5698fbffc
|
||
|
|
31ad460757
|
||
|
|
4fd2a2a16c
|
||
|
|
6eb40de72c
|
||
|
|
cecbc94a95
|
||
|
|
3820fc4764
|
||
|
|
1b893a5b84
|
||
|
|
72661a343f
|
||
|
|
9ebe8e21dc
|
||
|
|
141f15b444
|
||
|
|
3a8a604a48
|
||
|
|
41493207b3
|
||
|
|
cbc4a2e149
|
||
|
|
7345e415a7
|
||
|
|
ff680614aa
|
||
|
|
3e110e2eb5
|
||
|
|
1ccb0a540e
|
||
|
|
f9da719b91
|
||
|
|
95f41025f4
|
||
|
|
eceda684f0
|
||
|
|
291c195ceb
|
||
|
|
1896497c1a
|
||
|
|
87254ef547
|
||
|
|
da34acd35b
|
||
|
|
d9d0625c67
|
||
|
|
08f789725b
|
||
|
|
33ac5c6280
|
||
|
|
762b9bcd11
|
||
|
|
38480d84f4
|
||
|
|
03a51b97ad
|
+36
@@ -0,0 +1,36 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: quality-check
|
||||||
|
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0
|
||||||
|
commands:
|
||||||
|
- melos run quality-check
|
||||||
|
- melos run publish:validate
|
||||||
|
- name: publish
|
||||||
|
image: git.wyatt-studio.fr/wyatt-foss/flutter-melos:2.9.0
|
||||||
|
commands:
|
||||||
|
- melos run publish:validate
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
+3
-5
@@ -13,10 +13,6 @@ build/
|
|||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
# If you're building an application, you may want to check-in your pubspec.lock
|
||||||
pubspec.lock
|
pubspec.lock
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
# dotenv environment variables file
|
# dotenv environment variables file
|
||||||
.env*
|
.env*
|
||||||
|
|
||||||
@@ -38,7 +34,6 @@ doc/api/
|
|||||||
|
|
||||||
### Flutter ###
|
### Flutter ###
|
||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
**/doc/api/
|
|
||||||
.fvm/
|
.fvm/
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
@@ -198,3 +193,6 @@ $RECYCLE.BIN/
|
|||||||
*.iml
|
*.iml
|
||||||
google-services.json
|
google-services.json
|
||||||
pubspec_overrides.yaml
|
pubspec_overrides.yaml
|
||||||
|
|
||||||
|
# Mason
|
||||||
|
.mason/
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
||||||
|
rev: v2.1.1
|
||||||
|
hooks:
|
||||||
|
- id: conventional-pre-commit
|
||||||
|
stages: [commit-msg]
|
||||||
|
args: [build, ci, docs, feat, fix, perf, refactor, style, test, chore]
|
||||||
Vendored
+6
-1
@@ -1,4 +1,10 @@
|
|||||||
{
|
{
|
||||||
|
// Dart
|
||||||
|
"dart.runPubGetOnPubspecChanges": "never",
|
||||||
|
// Gitea
|
||||||
|
"gitea.owner": "Wyatt-FOSS",
|
||||||
|
"gitea.repo": "wyatt-packages",
|
||||||
|
// Header
|
||||||
"psi-header.changes-tracking": {
|
"psi-header.changes-tracking": {
|
||||||
"isActive": true
|
"isActive": true
|
||||||
},
|
},
|
||||||
@@ -67,5 +73,4 @@
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dart.runPubGetOnPubspecChanges": false,
|
|
||||||
}
|
}
|
||||||
+277
@@ -3,6 +3,283 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## 2023-02-07
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_analysis` - `v2.4.0`](#wyatt_analysis---v240)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_analysis` - `v2.4.0`
|
||||||
|
|
||||||
|
- **FEAT**: add new lint rules.
|
||||||
|
- **DOCS**: add instructions to create a new version (closes #104).
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-12-13
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.4.1`](#wyatt_authentication_bloc---v041)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_authentication_bloc` - `v0.4.1`
|
||||||
|
|
||||||
|
- **REFACTOR**: use fromFirebaseUser factory to parse user.
|
||||||
|
- **REFACTOR**: update deps and re-export them.
|
||||||
|
- **FIX**: fix mock on register.
|
||||||
|
- **FEAT**: add google sign in in signIn cubit.
|
||||||
|
- **FEAT**: add google sign in parameter in firebase data source constructor.
|
||||||
|
- **FEAT**: add google sign_in support (closes #59).
|
||||||
|
- **FEAT**: add reauthenticate, updateEmail and updatePassword.
|
||||||
|
- **DOCS**: add correct header.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-12-12
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_analysis` - `v2.3.0`](#wyatt_analysis---v230)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_analysis` - `v2.3.0`
|
||||||
|
|
||||||
|
- **REFACTOR**: follow melos versioning.
|
||||||
|
- **FIX**: change file include to keep coherence.
|
||||||
|
- **FEAT**: exclude generated code, and add dart>2.16 rules.
|
||||||
|
- **FEAT**: add overwrite protection.
|
||||||
|
- **FEAT**: add 2.2.2 files for archive.
|
||||||
|
- **FEAT**: add utils script to easely bump version.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-12-04
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- [`wyatt_bloc_helper` - `v2.0.0`](#wyatt_bloc_helper---v200)
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_type_utils` - `v0.0.4`](#wyatt_type_utils---v004)
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.4.0+3`](#wyatt_authentication_bloc---v0403)
|
||||||
|
- [`wyatt_crud_bloc` - `v0.1.0+2`](#wyatt_crud_bloc---v0102)
|
||||||
|
- [`wyatt_architecture` - `v0.1.0+1`](#wyatt_architecture---v0101)
|
||||||
|
- [`wyatt_form_bloc` - `v0.2.0+2`](#wyatt_form_bloc---v0202)
|
||||||
|
|
||||||
|
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_authentication_bloc` - `v0.4.0+3`
|
||||||
|
- `wyatt_crud_bloc` - `v0.1.0+2`
|
||||||
|
- `wyatt_architecture` - `v0.1.0+1`
|
||||||
|
- `wyatt_form_bloc` - `v0.2.0+2`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_bloc_helper` - `v2.0.0`
|
||||||
|
|
||||||
|
- **BREAKING** **REFACTOR**: update onWrap label (close #46).
|
||||||
|
|
||||||
|
#### `wyatt_type_utils` - `v0.0.4`
|
||||||
|
|
||||||
|
- **FEAT**: add Result extension on FutureOr type (close #40).
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-12-03
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- [`wyatt_architecture` - `v0.1.0`](#wyatt_architecture---v010)
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.4.0+2`](#wyatt_authentication_bloc---v0402)
|
||||||
|
- [`wyatt_crud_bloc` - `v0.1.0+1`](#wyatt_crud_bloc---v0101)
|
||||||
|
- [`wyatt_form_bloc` - `v0.2.0+1`](#wyatt_form_bloc---v0201)
|
||||||
|
|
||||||
|
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_authentication_bloc` - `v0.4.0+2`
|
||||||
|
- `wyatt_crud_bloc` - `v0.1.0+1`
|
||||||
|
- `wyatt_form_bloc` - `v0.2.0+1`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_architecture` - `v0.1.0`
|
||||||
|
|
||||||
|
- **REFACTOR**: update naming methodes (close #47).
|
||||||
|
- **REFACTOR**: update example. (close #38).
|
||||||
|
- **FIX**: fix execute method on error handler. (#38).
|
||||||
|
- **FEAT**: update usecase en add & sepcific case. (#38).
|
||||||
|
- **FEAT**: add obsevers for alternative usecase scenarions (#38).
|
||||||
|
- **DOCS**: generate class model. (#38).
|
||||||
|
- **DOCS**: update Readme. (#38).
|
||||||
|
- **BREAKING** **CHORE**: update exports. (#38).
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-11-16
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.4.0+1`](#wyatt_authentication_bloc---v0401)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_authentication_bloc` - `v0.4.0+1`
|
||||||
|
|
||||||
|
- **FIX**: add sort of mutex on onAuthChanges callback trigger.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-11-16
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.4.0`](#wyatt_authentication_bloc---v040)
|
||||||
|
- [`wyatt_form_bloc` - `v0.2.0`](#wyatt_form_bloc---v020)
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- There are no other changes in this release.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_authentication_bloc` - `v0.4.0`
|
||||||
|
|
||||||
|
- **REFACTOR**: update example with new input builders.
|
||||||
|
- **FIX**: add initial null account event in stream in the mock authentication.
|
||||||
|
- **BREAKING** **FIX**: add signInWithEmailAndPassword and signInAnonymously methods in SignInCubit #26.
|
||||||
|
|
||||||
|
#### `wyatt_form_bloc` - `v0.2.0`
|
||||||
|
|
||||||
|
- **FIX**: disable status selection and rebuild SubmitBuilder on every state changes #28.
|
||||||
|
- **FIX**: fix set operations behaviors.
|
||||||
|
- **FIX**: add nullable validator on boolean value.
|
||||||
|
- **FEAT**: add metadata tag to bypass validation #29.
|
||||||
|
- **FEAT**: add shorthands to access validator status.
|
||||||
|
- **BREAKING** **REFACTOR**: input builders provides FormInput.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-11-13
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- [`wyatt_crud_bloc` - `v0.1.0`](#wyatt_crud_bloc---v010)
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- There are no other changes in this release.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_crud_bloc` - `v0.1.0`
|
||||||
|
|
||||||
|
- **REFACTOR**: add vscode config.
|
||||||
|
- **FIX**: update example.
|
||||||
|
- **BREAKING** **REFACTOR**: migrate to wyatt architecture.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-11-11
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- There are no breaking changes in this release.
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.3.0+1`](#wyatt_authentication_bloc---v0301)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_authentication_bloc` - `v0.3.0+1`
|
||||||
|
|
||||||
|
- **FIX**: fix some bugs to validate publishing.
|
||||||
|
|
||||||
|
|
||||||
|
## 2022-11-11
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Packages with breaking changes:
|
||||||
|
|
||||||
|
- [`wyatt_authentication_bloc` - `v0.3.0`](#wyatt_authentication_bloc---v030)
|
||||||
|
|
||||||
|
Packages with other changes:
|
||||||
|
|
||||||
|
- There are no other changes in this release.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### `wyatt_authentication_bloc` - `v0.3.0`
|
||||||
|
|
||||||
|
- **REFACTOR**: use correct deps.
|
||||||
|
- **REFACTOR**: update example with new listeners.
|
||||||
|
- **FIX**: return exception and not throwing it anymore.
|
||||||
|
- **FIX**: exception returns msg as message.
|
||||||
|
- **FEAT**: add fully functionnal mock data source.
|
||||||
|
- **FEAT**: add toString and equality on entities and models.
|
||||||
|
- **BREAKING** **FEAT**: add email verification, password reset support.
|
||||||
|
|
||||||
|
|
||||||
## 2022-11-10
|
## 2022-11-10
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|||||||
@@ -51,36 +51,51 @@ and open source.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Development
|
## Contribution
|
||||||
|
|
||||||
Clone this repo.
|
Clone this repo.
|
||||||
|
|
||||||
You have to install [melos](https://github.com/invertase/melos).
|
```shell
|
||||||
|
git clone ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||||
|
```
|
||||||
|
|
||||||
|
### Prerequisite
|
||||||
|
|
||||||
|
- [Flutter](https://github.com/flutter/flutter).
|
||||||
|
|
||||||
|
- [Melos](https://github.com/invertase/melos). Used to manage Dart projects with multiple packages.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dart pub global activate melos
|
dart pub global activate melos
|
||||||
```
|
```
|
||||||
|
|
||||||
Then bootstrap with `melos bs`.
|
- [Mason](https://github.com/felangel/mason). Used for code generation.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
dart pub global activate mason_cli
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Lcov](https://github.com/linux-test-project/lcov). Used to generate coverage data.
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# on macos
|
||||||
|
brew install lcov
|
||||||
|
```
|
||||||
|
|
||||||
|
- genhtml. Used to convert coverage data into html pages.
|
||||||
|
|
||||||
|
After installing all these packages, bootstrap with `melos bs`.
|
||||||
|
|
||||||
### Create a new package
|
### Create a new package
|
||||||
|
|
||||||
Create a new package in `packages/` folder.
|
Create a new package in `packages/` folder.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dart create -t package-simple wyatt_<name>
|
mason make wyatt_package --package_name wyatt_<name> --description A new Wyatt package --flutter_only false
|
||||||
```
|
|
||||||
|
|
||||||
Remove any `example/` subfolder. Then create a new sample project.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
flutter create --platforms android --project-name <name>_example example
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then bootstrap project with `melos bs` command.
|
Then bootstrap project with `melos bs` command.
|
||||||
|
|
||||||
### Convention
|
|
||||||
|
|
||||||
#### Naming
|
#### Naming
|
||||||
|
|
||||||
In the previous instructions `<name>` variable is important.
|
In the previous instructions `<name>` variable is important.
|
||||||
@@ -93,15 +108,44 @@ You **MUST** use `wyatt` prefix for package.
|
|||||||
You **MUST** name example with specific name.
|
You **MUST** name example with specific name.
|
||||||
|
|
||||||
For example, if name is CRUD BLOC
|
For example, if name is CRUD BLOC
|
||||||
|
|
||||||
- name will be crud_bloc
|
- name will be crud_bloc
|
||||||
- so the package will be: `wyatt_crud_bloc`
|
- so the package will be: `wyatt_crud_bloc`
|
||||||
- and the example will be: `crud_bloc_example`
|
- and the example will be: `crud_bloc_example`
|
||||||
|
|
||||||
#### Commits
|
### Create issues
|
||||||
|
|
||||||
|
Add the issues directly related to what you want to develop and label them correctly.
|
||||||
|
|
||||||
|
```
|
||||||
|
Type(scope): issue.
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, on notification bloc package :
|
||||||
|
|
||||||
|
- `Feature(notification_bloc): add firebase messaging data source.`
|
||||||
|
- `Test(notification_bloc): add test for pushwoosh datasource.`
|
||||||
|
|
||||||
|
### Branches
|
||||||
|
|
||||||
|
Master is protected. You can't push on it. Please develop your feature on another branch. The name of your branch has to match with the issue opened.
|
||||||
|
|
||||||
|
`type(scope):issue`
|
||||||
|
|
||||||
|
Example :
|
||||||
|
Issue :
|
||||||
|
|
||||||
|
- `Feature(notification_bloc): add firebase messaging data source.`
|
||||||
|
|
||||||
|
Branch related to this issue :
|
||||||
|
|
||||||
|
- `feature(notification_bloc)/add_firebase_messaging_data_source`
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
tl;dr : `type(scope): description`.
|
tl;dr : `type(scope): description #issue`.
|
||||||
Here allowed <type> values:
|
Here allowed <type> values:
|
||||||
|
|
||||||
- **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version.
|
- **feat** for a new feature for the user, not a new feature for build script. Such commit will trigger a release bumping a MINOR version.
|
||||||
@@ -115,11 +159,74 @@ Here allowed <type> values:
|
|||||||
|
|
||||||
Some examples :
|
Some examples :
|
||||||
|
|
||||||
- `feat(auth): add AWS support.` = add a feature in authentication_bloc package.
|
- `feat(auth): add AWS support. (#31)` = add a feature in authentication_bloc package, linked to the 31st issue.
|
||||||
- `docs: update readme.` = update **this** readme file.
|
- `docs: update readme.` = update **this** readme file.
|
||||||
- `fix(crud)!: fix bug in awesome() function.` = fix a bug, `!` is important and indicate `BREAKING CHANGES`.
|
- `fix(crud)!: fix bug in awesome() function. (#32)` = fix a bug, `!` is important and indicate `BREAKING CHANGES` linked with the 32nd issue.
|
||||||
|
|
||||||
Conventional commits are important for `melos version` command !
|
When you have finished developing, and are ready to close the issue, close it via your commit :
|
||||||
|
|
||||||
|
`feat(auth): add AWS support. (close #31)`
|
||||||
|
|
||||||
|
Note that your issue will be close after merging on master.
|
||||||
|
Before closing the issue, please check tests and update coverage. You might run :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
melos run test:all # this will run all tests in this project
|
||||||
|
melos run gen-coverage # this will generate coverage report
|
||||||
|
melos run gen-class-models # this will generate plantuml class diagrams
|
||||||
|
melos run quality-check # this will run all targets generally expected in CI
|
||||||
|
melos run publish:validate # this will run a validation before publish packages
|
||||||
|
melos run publish # this will publish packages
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note that only modified package will be verified and published.
|
||||||
|
|
||||||
|
#### Merge your work
|
||||||
|
|
||||||
|
After closing your issue, some work may have been done on master in the meantime. To keep a clean git history, please rebase before opening a change request.
|
||||||
|
|
||||||
|
Two situations :
|
||||||
|
|
||||||
|
- You have not yet created your branch and have committed locally :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git pull --rebase
|
||||||
|
```
|
||||||
|
|
||||||
|
- You are already working on your branch :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git rebase -i master
|
||||||
|
```
|
||||||
|
|
||||||
|
If possible, please use `--fixup` on your commit in interactive rebase.
|
||||||
|
|
||||||
|
Then, opend your PR, get the necessary approval and merge your work. Then you're done ✅.
|
||||||
|
|
||||||
|
#### Update version.
|
||||||
|
|
||||||
|
Once your work is on the master, you can update your package version. Please filter packages to update only your package. `--scope` is used to do it.
|
||||||
|
For example, after merging changes on `wyatt_otification_bloc` package, you might run :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
melos version --scope="*wyatt_notification_bloc*"
|
||||||
|
```
|
||||||
|
|
||||||
|
In fact, melos will filter all packages that match the `wyatt_notification_block` pattern.
|
||||||
|
|
||||||
|
You can update check all packages tests by running :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
melos run test
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Publish your package
|
||||||
|
|
||||||
|
If package is ready for procution, publish it runnig :
|
||||||
|
|
||||||
|
```shell
|
||||||
|
melos publish --scope"*package*"
|
||||||
|
```
|
||||||
|
|
||||||
#### Badging
|
#### Badging
|
||||||
|
|
||||||
@@ -130,6 +237,7 @@ In the package `readme.md` file, please specify the supported SDK:
|
|||||||
```markdown
|
```markdown
|
||||||

|

|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||

|

|
||||||
@@ -162,3 +270,9 @@ Here you can change `package name` and `package version`.
|
|||||||

|

|
||||||
|
|
||||||
This repository is maintained by Wyatt Studio but work is in progress.
|
This repository is maintained by Wyatt Studio but work is in progress.
|
||||||
|
|
||||||
|
## Simple work flow diagramm
|
||||||
|
|
||||||
|
To sum up, here a simple work flow diagramm.
|
||||||
|
|
||||||
|

|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
escapedPath="$(echo `pwd` | sed 's/\//\\\//g')"
|
||||||
|
|
||||||
|
if grep flutter pubspec.yaml > /dev/null; then
|
||||||
|
if [ -d "coverage" ]; then
|
||||||
|
# combine line coverage info from package tests to a common file
|
||||||
|
if [ ! -d "$MELOS_ROOT_PATH/coverage" ]; then
|
||||||
|
mkdir "$MELOS_ROOT_PATH/coverage"
|
||||||
|
fi
|
||||||
|
sed "s/^SF:lib/SF:$escapedPath\/lib/g" coverage/lcov.info >> "$MELOS_ROOT_PATH/coverage/lcov.info"
|
||||||
|
rm -rf "coverage"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
@startuml Simple Developpment Workflow
|
||||||
|
start
|
||||||
|
:Create an issue;
|
||||||
|
:Create branch related to the issue;
|
||||||
|
repeat :Commit related to the issue;
|
||||||
|
repeat while (feature is done)
|
||||||
|
:Update coverage;
|
||||||
|
:Close issue via last commit;
|
||||||
|
:Rebase from `master`;
|
||||||
|
:Create pull request;
|
||||||
|
:Merge branches;
|
||||||
|
:Update version;
|
||||||
|
:Publish package;
|
||||||
|
stop
|
||||||
|
@enduml
|
||||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 7.5 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"bricks":{"wyatt_clean_code":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_clean_code","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}},"wyatt_feature_brick":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_feature_brick","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}},"wyatt_package_template":{"git":{"url":"ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git","path":"bricks/wyatt_package_template","ref":"5009f1ef21d8531b773298c0fc08704d8f69afd1"}}}}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
bricks:
|
||||||
|
wyatt_clean_code:
|
||||||
|
git:
|
||||||
|
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
|
||||||
|
path: bricks/wyatt_clean_code
|
||||||
|
wyatt_feature_brick:
|
||||||
|
git:
|
||||||
|
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
|
||||||
|
path: bricks/wyatt_feature_brick
|
||||||
|
wyatt_package_template:
|
||||||
|
git:
|
||||||
|
url: "ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-bricks.git"
|
||||||
|
path: bricks/wyatt_package_template
|
||||||
+35
-2
@@ -21,8 +21,7 @@ scripts:
|
|||||||
|
|
||||||
analyze:
|
analyze:
|
||||||
run: |
|
run: |
|
||||||
melos exec -c 10 -- \
|
melos exec -c 1 -- flutter analyze --fatal-infos
|
||||||
flutter analyze --fatal-infos
|
|
||||||
description: Run `flutter analyze` for all packages.
|
description: Run `flutter analyze` for all packages.
|
||||||
|
|
||||||
format:
|
format:
|
||||||
@@ -37,6 +36,40 @@ scripts:
|
|||||||
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`.
|
||||||
|
|
||||||
|
test:selective_unit_test:
|
||||||
|
run: melos exec -- flutter test --no-pub --coverage
|
||||||
|
description: Run Flutter tests for a specific package in this project.
|
||||||
|
select-package:
|
||||||
|
dir-exists:
|
||||||
|
- test
|
||||||
|
ignore:
|
||||||
|
- '*example*'
|
||||||
|
|
||||||
|
test:all:
|
||||||
|
run: melos run test:selective_unit_test --no-select
|
||||||
|
description: Run all Flutter tests in this project.
|
||||||
|
|
||||||
|
gen-coverage: melos exec -- sh "\$MELOS_ROOT_PATH/combine_coverage.sh" && genhtml coverage/lcov.info -o coverage/html
|
||||||
|
|
||||||
|
gen-class-models:
|
||||||
|
run: melos exec -- dart pub global run dcdg -o models/class-models.puml
|
||||||
|
select-package:
|
||||||
|
ignore:
|
||||||
|
- '*example*'
|
||||||
|
|
||||||
|
quality-check:
|
||||||
|
run: |
|
||||||
|
melos clean && \
|
||||||
|
melos bootstrap && \
|
||||||
|
melos run test:all
|
||||||
|
description: Run all targets generally expected in CI for a full local quality check.
|
||||||
|
|
||||||
|
publish:validate:
|
||||||
|
run: melos publish --diff="origin/$DRONE_COMMIT_BRANCH...HEAD" --yes
|
||||||
|
|
||||||
|
# publish:
|
||||||
|
# run: melos publish --diff="origin/$DRONE_COMMIT_BRANCH...HEAD" --no-dry-run --yes
|
||||||
|
|
||||||
# Additional cleanup lifecycle script, executed when `melos clean` is run.
|
# Additional cleanup lifecycle script, executed when `melos clean` is run.
|
||||||
postclean: >
|
postclean: >
|
||||||
melos exec -c 6 -- "flutter clean"
|
melos exec -c 6 -- "flutter clean"
|
||||||
@@ -1,3 +1,17 @@
|
|||||||
|
## 2.4.0
|
||||||
|
|
||||||
|
- **FEAT**: add new lint rules.
|
||||||
|
- **DOCS**: add instructions to create a new version (closes #104).
|
||||||
|
|
||||||
|
## 2.3.0
|
||||||
|
|
||||||
|
- **REFACTOR**: follow melos versioning.
|
||||||
|
- **FIX**: change file include to keep coherence.
|
||||||
|
- **FEAT**: exclude generated code, and add dart>2.16 rules.
|
||||||
|
- **FEAT**: add overwrite protection.
|
||||||
|
- **FEAT**: add 2.2.2 files for archive.
|
||||||
|
- **FEAT**: add utils script to easely bump version.
|
||||||
|
|
||||||
## 2.2.2
|
## 2.2.2
|
||||||
|
|
||||||
- **DOCS**: add publish_to self hosted pub server.
|
- **DOCS**: add publish_to self hosted pub server.
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -20,24 +20,21 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.0.0.yaml**.
|
This package provides lint rules for Dart and Flutter which are used at [Wyatt](https://wyattapp.io) and [Wyatt Studio](https://wyatt-studio.fr). For more information, see the complete list of options in **lib/analysis_options.2.4.0.yaml**.
|
||||||
|
|
||||||
**Note**: This package was heavily inspired by [pedantic](https://github.com/dart-lang/pedantic), [Very Good Analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) and the official [flutter_lints](https://pub.dev/packages/flutter_lints).
|
**Note**: This package was heavily inspired by [pedantic](https://github.com/dart-lang/pedantic), [Very Good Analysis](https://github.com/VeryGoodOpenSource/very_good_analysis) and the official [flutter_lints](https://pub.dev/packages/flutter_lints).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
To use the lints, add a dependency in your `pubspec.yaml`:
|
To use the lints, add a dependency in your `pubspec.yaml` :
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dev_dependencies:
|
wyatt_analysis:
|
||||||
wyatt_analysis:
|
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
|
||||||
git:
|
version: 2.4.0
|
||||||
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
|
|
||||||
ref: wyatt_analysis-v2.0.0
|
|
||||||
path: packages/wyatt_analysis
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, add an include in `analysis_options.yaml`:
|
Then, add an include in `analysis_options.yaml` :
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
include: package:wyatt_analysis/analysis_options.yaml
|
include: package:wyatt_analysis/analysis_options.yaml
|
||||||
@@ -52,13 +49,13 @@ include: package:wyatt_analysis/analysis_options.flutter.yaml
|
|||||||
If you wish to restrict the lint version, specify a version of `analysis_options.yaml` instead:
|
If you wish to restrict the lint version, specify a version of `analysis_options.yaml` instead:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
include: package:wyatt_analysis/analysis_options.flutter.2.0.0.yaml
|
include: package:wyatt_analysis/analysis_options.flutter.2.4.0.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
If you just want **Dart** version:
|
If you just want **Dart** version:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
include: package:wyatt_analysis/analysis_options.2.0.0.yaml
|
include: package:wyatt_analysis/analysis_options.2.4.0.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Suppressing Lints
|
## Suppressing Lints
|
||||||
@@ -90,7 +87,7 @@ class B {}
|
|||||||
|
|
||||||
### Project Level
|
### Project Level
|
||||||
|
|
||||||
To surpress a specific lint rule for an entire project, modify `analysis_options.yaml`:
|
To surpress a specific lint rule for an entire project, modify `analysis_options.yaml` :
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
include: package:wyatt_analysis/analysis_options.yaml
|
include: package:wyatt_analysis/analysis_options.yaml
|
||||||
@@ -107,6 +104,16 @@ To indicate your project is using `wyatt_analysis` → [![style: wyatt analysis]
|
|||||||
[](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis)
|
[](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
When you want to create a new version of the plugin. Before any modification, execute the following command to create new files:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./new_version.sh <previous_version> <new_version>
|
||||||
|
```
|
||||||
|
> Where `<previous_version>` is 2.4.0
|
||||||
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
You can explore every lint rules [here](https://dart-lang.github.io/linter/lints/).
|
You can explore every lint rules [here](https://dart-lang.github.io/linter/lints/).
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
language:
|
||||||
|
strict-casts: true
|
||||||
|
strict-inference: true
|
||||||
|
strict-raw-types: true
|
||||||
|
|
||||||
|
errors:
|
||||||
|
todo: ignore
|
||||||
|
close_sinks: ignore
|
||||||
|
missing_required_param: error
|
||||||
|
missing_return: error
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- example/**
|
||||||
|
- lib/l10n/**
|
||||||
|
- lib/generated/**
|
||||||
|
- lib/generated_plugin_registrant.dart
|
||||||
|
- test/.test_coverage.dart
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- always_declare_return_types
|
||||||
|
- always_require_non_null_named_parameters
|
||||||
|
- always_put_control_body_on_new_line
|
||||||
|
- always_put_required_named_parameters_first
|
||||||
|
- always_use_package_imports
|
||||||
|
- annotate_overrides
|
||||||
|
- avoid_bool_literals_in_conditional_expressions
|
||||||
|
- avoid_catching_errors
|
||||||
|
- avoid_double_and_int_checks
|
||||||
|
- avoid_dynamic_calls
|
||||||
|
- avoid_empty_else
|
||||||
|
- avoid_equals_and_hash_code_on_mutable_classes
|
||||||
|
- avoid_escaping_inner_quotes
|
||||||
|
- avoid_field_initializers_in_const_classes
|
||||||
|
- avoid_function_literals_in_foreach_calls
|
||||||
|
- avoid_init_to_null
|
||||||
|
- avoid_js_rounded_ints
|
||||||
|
- avoid_null_checks_in_equality_operators
|
||||||
|
- avoid_positional_boolean_parameters
|
||||||
|
- avoid_private_typedef_functions
|
||||||
|
- avoid_redundant_argument_values
|
||||||
|
- avoid_relative_lib_imports
|
||||||
|
- avoid_renaming_method_parameters
|
||||||
|
- avoid_return_types_on_setters
|
||||||
|
- avoid_returning_null
|
||||||
|
- avoid_returning_null_for_future
|
||||||
|
- avoid_returning_null_for_void
|
||||||
|
- avoid_returning_this
|
||||||
|
- avoid_setters_without_getters
|
||||||
|
- avoid_shadowing_type_parameters
|
||||||
|
- avoid_single_cascade_in_expression_statements
|
||||||
|
- avoid_slow_async_io
|
||||||
|
- avoid_type_to_string
|
||||||
|
- avoid_types_as_parameter_names
|
||||||
|
- avoid_types_on_closure_parameters
|
||||||
|
- avoid_unused_constructor_parameters
|
||||||
|
- avoid_void_async
|
||||||
|
- await_only_futures
|
||||||
|
- camel_case_extensions
|
||||||
|
- camel_case_types
|
||||||
|
- cancel_subscriptions
|
||||||
|
- cascade_invocations
|
||||||
|
- cast_nullable_to_non_nullable
|
||||||
|
- comment_references
|
||||||
|
- conditional_uri_does_not_exist
|
||||||
|
- constant_identifier_names
|
||||||
|
- control_flow_in_finally
|
||||||
|
- curly_braces_in_flow_control_structures
|
||||||
|
- depend_on_referenced_packages
|
||||||
|
- deprecated_consistency
|
||||||
|
- directives_ordering
|
||||||
|
- empty_catches
|
||||||
|
- empty_constructor_bodies
|
||||||
|
- empty_statements
|
||||||
|
- eol_at_end_of_file
|
||||||
|
- exhaustive_cases
|
||||||
|
- file_names
|
||||||
|
- flutter_style_todos
|
||||||
|
- hash_and_equals
|
||||||
|
- implementation_imports
|
||||||
|
- iterable_contains_unrelated_type
|
||||||
|
- join_return_with_assignment
|
||||||
|
- leading_newlines_in_multiline_strings
|
||||||
|
- library_names
|
||||||
|
- library_prefixes
|
||||||
|
- library_private_types_in_public_api
|
||||||
|
- lines_longer_than_80_chars
|
||||||
|
- list_remove_unrelated_type
|
||||||
|
- literal_only_boolean_expressions
|
||||||
|
- missing_whitespace_between_adjacent_strings
|
||||||
|
- no_adjacent_strings_in_list
|
||||||
|
- no_default_cases
|
||||||
|
- no_duplicate_case_values
|
||||||
|
- no_leading_underscores_for_local_identifiers
|
||||||
|
- no_runtimeType_toString
|
||||||
|
- non_constant_identifier_names
|
||||||
|
- noop_primitive_operations
|
||||||
|
- null_check_on_nullable_type_parameter
|
||||||
|
- null_closures
|
||||||
|
- one_member_abstracts
|
||||||
|
- only_throw_errors
|
||||||
|
- overridden_fields
|
||||||
|
- package_api_docs
|
||||||
|
- package_names
|
||||||
|
- package_prefixed_library_names
|
||||||
|
- parameter_assignments
|
||||||
|
- prefer_adjacent_string_concatenation
|
||||||
|
- prefer_asserts_in_initializer_lists
|
||||||
|
- prefer_asserts_with_message
|
||||||
|
- prefer_collection_literals
|
||||||
|
- prefer_conditional_assignment
|
||||||
|
- prefer_const_constructors
|
||||||
|
- prefer_const_constructors_in_immutables
|
||||||
|
- prefer_const_declarations
|
||||||
|
- prefer_const_literals_to_create_immutables
|
||||||
|
- prefer_constructors_over_static_methods
|
||||||
|
- prefer_contains
|
||||||
|
- prefer_equal_for_default_values
|
||||||
|
- prefer_expression_function_bodies
|
||||||
|
- prefer_final_fields
|
||||||
|
- prefer_final_in_for_each
|
||||||
|
- prefer_final_locals
|
||||||
|
- prefer_for_elements_to_map_fromIterable
|
||||||
|
- prefer_function_declarations_over_variables
|
||||||
|
- prefer_generic_function_type_aliases
|
||||||
|
- prefer_if_elements_to_conditional_expressions
|
||||||
|
- prefer_if_null_operators
|
||||||
|
- prefer_initializing_formals
|
||||||
|
- prefer_inlined_adds
|
||||||
|
- prefer_int_literals
|
||||||
|
- prefer_interpolation_to_compose_strings
|
||||||
|
- prefer_is_empty
|
||||||
|
- prefer_is_not_empty
|
||||||
|
- prefer_is_not_operator
|
||||||
|
- prefer_iterable_whereType
|
||||||
|
- prefer_mixin
|
||||||
|
- prefer_null_aware_operators
|
||||||
|
- prefer_null_aware_method_calls
|
||||||
|
- prefer_single_quotes
|
||||||
|
- prefer_spread_collections
|
||||||
|
- prefer_typing_uninitialized_variables
|
||||||
|
- prefer_void_to_null
|
||||||
|
- provide_deprecation_message
|
||||||
|
- recursive_getters
|
||||||
|
- require_trailing_commas
|
||||||
|
- slash_for_doc_comments
|
||||||
|
- sort_unnamed_constructors_first
|
||||||
|
- test_types_in_equals
|
||||||
|
- throw_in_finally
|
||||||
|
- tighten_type_of_initializing_formals
|
||||||
|
- type_annotate_public_apis
|
||||||
|
- type_init_formals
|
||||||
|
- unawaited_futures
|
||||||
|
- unnecessary_await_in_return
|
||||||
|
- unnecessary_brace_in_string_interps
|
||||||
|
- unnecessary_const
|
||||||
|
- unnecessary_constructor_name
|
||||||
|
- unnecessary_getters_setters
|
||||||
|
- unnecessary_lambdas
|
||||||
|
- unnecessary_late
|
||||||
|
- unnecessary_new
|
||||||
|
- unnecessary_null_aware_assignments
|
||||||
|
- unnecessary_null_checks
|
||||||
|
- unnecessary_null_in_if_null_operators
|
||||||
|
- unnecessary_nullable_for_final_variable_declarations
|
||||||
|
- unnecessary_overrides
|
||||||
|
- unnecessary_parenthesis
|
||||||
|
- unnecessary_raw_strings
|
||||||
|
- unnecessary_statements
|
||||||
|
- unnecessary_string_escapes
|
||||||
|
- unnecessary_string_interpolations
|
||||||
|
- unnecessary_this
|
||||||
|
- unrelated_type_equality_checks
|
||||||
|
- unsafe_html
|
||||||
|
- use_enums
|
||||||
|
- use_function_type_syntax_for_parameters
|
||||||
|
- use_if_null_to_convert_nulls_to_bools
|
||||||
|
- use_is_even_rather_than_modulo
|
||||||
|
- use_late_for_private_fields_and_variables
|
||||||
|
- use_named_constants
|
||||||
|
- use_raw_strings
|
||||||
|
- use_rethrow_when_possible
|
||||||
|
- use_setters_to_change_properties
|
||||||
|
- use_string_buffers
|
||||||
|
- use_super_parameters
|
||||||
|
- use_test_throws_matchers
|
||||||
|
- use_to_and_as_if_applicable
|
||||||
|
- valid_regexps
|
||||||
|
- void_checks
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
language:
|
||||||
|
strict-casts: true
|
||||||
|
strict-inference: true
|
||||||
|
strict-raw-types: true
|
||||||
|
|
||||||
|
errors:
|
||||||
|
todo: info
|
||||||
|
close_sinks: ignore
|
||||||
|
missing_required_param: error
|
||||||
|
missing_return: error
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- lib/l10n/**
|
||||||
|
- lib/generated/**
|
||||||
|
- lib/gen/**
|
||||||
|
- lib/generated_plugin_registrant.dart
|
||||||
|
- test/.test_coverage.dart
|
||||||
|
- '**/*.g.dart'
|
||||||
|
- '**/*.freezed.dart'
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- always_declare_return_types
|
||||||
|
- always_put_control_body_on_new_line
|
||||||
|
- always_put_required_named_parameters_first
|
||||||
|
- always_require_non_null_named_parameters
|
||||||
|
- always_use_package_imports
|
||||||
|
- annotate_overrides
|
||||||
|
- avoid_bool_literals_in_conditional_expressions
|
||||||
|
- avoid_catching_errors
|
||||||
|
- avoid_double_and_int_checks
|
||||||
|
- avoid_dynamic_calls
|
||||||
|
- avoid_empty_else
|
||||||
|
- avoid_equals_and_hash_code_on_mutable_classes
|
||||||
|
- avoid_escaping_inner_quotes
|
||||||
|
- avoid_field_initializers_in_const_classes
|
||||||
|
- avoid_final_parameters
|
||||||
|
- avoid_function_literals_in_foreach_calls
|
||||||
|
- avoid_init_to_null
|
||||||
|
- avoid_js_rounded_ints
|
||||||
|
- avoid_multiple_declarations_per_line
|
||||||
|
- avoid_null_checks_in_equality_operators
|
||||||
|
- avoid_positional_boolean_parameters
|
||||||
|
- avoid_private_typedef_functions
|
||||||
|
- avoid_redundant_argument_values
|
||||||
|
- avoid_relative_lib_imports
|
||||||
|
- avoid_renaming_method_parameters
|
||||||
|
- avoid_return_types_on_setters
|
||||||
|
- avoid_returning_null
|
||||||
|
- avoid_returning_null_for_future
|
||||||
|
- avoid_returning_null_for_void
|
||||||
|
- avoid_returning_this
|
||||||
|
- avoid_setters_without_getters
|
||||||
|
- avoid_shadowing_type_parameters
|
||||||
|
- avoid_single_cascade_in_expression_statements
|
||||||
|
- avoid_slow_async_io
|
||||||
|
- avoid_type_to_string
|
||||||
|
- avoid_types_as_parameter_names
|
||||||
|
- avoid_types_on_closure_parameters
|
||||||
|
- avoid_unused_constructor_parameters
|
||||||
|
- avoid_void_async
|
||||||
|
- await_only_futures
|
||||||
|
- camel_case_extensions
|
||||||
|
- camel_case_types
|
||||||
|
- cancel_subscriptions
|
||||||
|
- cascade_invocations
|
||||||
|
- cast_nullable_to_non_nullable
|
||||||
|
- comment_references
|
||||||
|
- conditional_uri_does_not_exist
|
||||||
|
- constant_identifier_names
|
||||||
|
- control_flow_in_finally
|
||||||
|
- curly_braces_in_flow_control_structures
|
||||||
|
- depend_on_referenced_packages
|
||||||
|
- deprecated_consistency
|
||||||
|
- directives_ordering
|
||||||
|
- empty_catches
|
||||||
|
- empty_constructor_bodies
|
||||||
|
- empty_statements
|
||||||
|
- eol_at_end_of_file
|
||||||
|
- exhaustive_cases
|
||||||
|
- file_names
|
||||||
|
- flutter_style_todos
|
||||||
|
- hash_and_equals
|
||||||
|
- implementation_imports
|
||||||
|
- iterable_contains_unrelated_type
|
||||||
|
- join_return_with_assignment
|
||||||
|
- leading_newlines_in_multiline_strings
|
||||||
|
- library_names
|
||||||
|
- library_prefixes
|
||||||
|
- library_private_types_in_public_api
|
||||||
|
- lines_longer_than_80_chars
|
||||||
|
- list_remove_unrelated_type
|
||||||
|
- literal_only_boolean_expressions
|
||||||
|
- missing_whitespace_between_adjacent_strings
|
||||||
|
- no_adjacent_strings_in_list
|
||||||
|
- no_default_cases
|
||||||
|
- no_duplicate_case_values
|
||||||
|
- no_leading_underscores_for_library_prefixes
|
||||||
|
- no_leading_underscores_for_local_identifiers
|
||||||
|
- no_runtimeType_toString
|
||||||
|
- non_constant_identifier_names
|
||||||
|
- noop_primitive_operations
|
||||||
|
- null_check_on_nullable_type_parameter
|
||||||
|
- null_closures
|
||||||
|
- one_member_abstracts
|
||||||
|
- only_throw_errors
|
||||||
|
- overridden_fields
|
||||||
|
- package_api_docs
|
||||||
|
- package_names
|
||||||
|
- package_prefixed_library_names
|
||||||
|
- parameter_assignments
|
||||||
|
- prefer_adjacent_string_concatenation
|
||||||
|
- prefer_asserts_in_initializer_lists
|
||||||
|
- prefer_asserts_with_message
|
||||||
|
- prefer_collection_literals
|
||||||
|
- prefer_conditional_assignment
|
||||||
|
- prefer_const_constructors
|
||||||
|
- prefer_const_constructors_in_immutables
|
||||||
|
- prefer_const_declarations
|
||||||
|
- prefer_const_literals_to_create_immutables
|
||||||
|
- prefer_constructors_over_static_methods
|
||||||
|
- prefer_contains
|
||||||
|
- prefer_equal_for_default_values
|
||||||
|
- prefer_expression_function_bodies
|
||||||
|
- prefer_final_fields
|
||||||
|
- prefer_final_in_for_each
|
||||||
|
- prefer_final_locals
|
||||||
|
- prefer_for_elements_to_map_fromIterable
|
||||||
|
- prefer_function_declarations_over_variables
|
||||||
|
- prefer_generic_function_type_aliases
|
||||||
|
- prefer_if_elements_to_conditional_expressions
|
||||||
|
- prefer_if_null_operators
|
||||||
|
- prefer_initializing_formals
|
||||||
|
- prefer_inlined_adds
|
||||||
|
- prefer_int_literals
|
||||||
|
- prefer_interpolation_to_compose_strings
|
||||||
|
- prefer_is_empty
|
||||||
|
- prefer_is_not_empty
|
||||||
|
- prefer_is_not_operator
|
||||||
|
- prefer_iterable_whereType
|
||||||
|
- prefer_mixin
|
||||||
|
- prefer_null_aware_method_calls
|
||||||
|
- prefer_null_aware_operators
|
||||||
|
- prefer_single_quotes
|
||||||
|
- prefer_spread_collections
|
||||||
|
- prefer_typing_uninitialized_variables
|
||||||
|
- prefer_void_to_null
|
||||||
|
- provide_deprecation_message
|
||||||
|
- recursive_getters
|
||||||
|
- require_trailing_commas
|
||||||
|
- slash_for_doc_comments
|
||||||
|
- sort_constructors_first
|
||||||
|
- sort_unnamed_constructors_first
|
||||||
|
- test_types_in_equals
|
||||||
|
- throw_in_finally
|
||||||
|
- tighten_type_of_initializing_formals
|
||||||
|
- type_annotate_public_apis
|
||||||
|
- type_init_formals
|
||||||
|
- unawaited_futures
|
||||||
|
- unnecessary_await_in_return
|
||||||
|
- unnecessary_brace_in_string_interps
|
||||||
|
- unnecessary_const
|
||||||
|
- unnecessary_constructor_name
|
||||||
|
- unnecessary_getters_setters
|
||||||
|
- unnecessary_lambdas
|
||||||
|
- unnecessary_late
|
||||||
|
- unnecessary_new
|
||||||
|
- unnecessary_null_aware_assignments
|
||||||
|
- unnecessary_null_checks
|
||||||
|
- unnecessary_null_in_if_null_operators
|
||||||
|
- unnecessary_nullable_for_final_variable_declarations
|
||||||
|
- unnecessary_overrides
|
||||||
|
- unnecessary_parenthesis
|
||||||
|
- unnecessary_raw_strings
|
||||||
|
- unnecessary_statements
|
||||||
|
- unnecessary_string_escapes
|
||||||
|
- unnecessary_string_interpolations
|
||||||
|
- unnecessary_this
|
||||||
|
- unnecessary_to_list_in_spreads
|
||||||
|
- unrelated_type_equality_checks
|
||||||
|
- unsafe_html
|
||||||
|
- use_enums
|
||||||
|
- use_function_type_syntax_for_parameters
|
||||||
|
- use_if_null_to_convert_nulls_to_bools
|
||||||
|
- use_is_even_rather_than_modulo
|
||||||
|
- use_late_for_private_fields_and_variables
|
||||||
|
- use_named_constants
|
||||||
|
- use_raw_strings
|
||||||
|
- use_rethrow_when_possible
|
||||||
|
- use_setters_to_change_properties
|
||||||
|
- use_string_buffers
|
||||||
|
- use_super_parameters
|
||||||
|
- use_test_throws_matchers
|
||||||
|
- use_to_and_as_if_applicable
|
||||||
|
- valid_regexps
|
||||||
|
- void_checks
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
# Copyright (C) 2023 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/>.
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
language:
|
||||||
|
strict-casts: true
|
||||||
|
strict-inference: true
|
||||||
|
strict-raw-types: true
|
||||||
|
|
||||||
|
errors:
|
||||||
|
todo: info
|
||||||
|
close_sinks: ignore
|
||||||
|
missing_required_param: error
|
||||||
|
missing_return: error
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- lib/l10n/**
|
||||||
|
- lib/generated/**
|
||||||
|
- lib/gen/**
|
||||||
|
- lib/generated_plugin_registrant.dart
|
||||||
|
- test/.test_coverage.dart
|
||||||
|
- '**/*.g.dart'
|
||||||
|
- '**/*.freezed.dart'
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- always_declare_return_types
|
||||||
|
- always_put_control_body_on_new_line
|
||||||
|
- always_put_required_named_parameters_first
|
||||||
|
- always_require_non_null_named_parameters
|
||||||
|
- always_use_package_imports
|
||||||
|
- annotate_overrides
|
||||||
|
- avoid_bool_literals_in_conditional_expressions
|
||||||
|
- avoid_catching_errors
|
||||||
|
- avoid_double_and_int_checks
|
||||||
|
- avoid_dynamic_calls
|
||||||
|
- avoid_empty_else
|
||||||
|
- avoid_equals_and_hash_code_on_mutable_classes
|
||||||
|
- avoid_escaping_inner_quotes
|
||||||
|
- avoid_field_initializers_in_const_classes
|
||||||
|
- avoid_final_parameters
|
||||||
|
- avoid_function_literals_in_foreach_calls
|
||||||
|
- avoid_init_to_null
|
||||||
|
- avoid_js_rounded_ints
|
||||||
|
- avoid_multiple_declarations_per_line
|
||||||
|
- avoid_null_checks_in_equality_operators
|
||||||
|
- avoid_positional_boolean_parameters
|
||||||
|
- avoid_private_typedef_functions
|
||||||
|
- avoid_redundant_argument_values
|
||||||
|
- avoid_relative_lib_imports
|
||||||
|
- avoid_renaming_method_parameters
|
||||||
|
- avoid_return_types_on_setters
|
||||||
|
- avoid_returning_null
|
||||||
|
- avoid_returning_null_for_future
|
||||||
|
- avoid_returning_null_for_void
|
||||||
|
- avoid_returning_this
|
||||||
|
- avoid_setters_without_getters
|
||||||
|
- avoid_shadowing_type_parameters
|
||||||
|
- avoid_single_cascade_in_expression_statements
|
||||||
|
- avoid_slow_async_io
|
||||||
|
- avoid_type_to_string
|
||||||
|
- avoid_types_as_parameter_names
|
||||||
|
- avoid_types_on_closure_parameters
|
||||||
|
- avoid_unused_constructor_parameters
|
||||||
|
- avoid_void_async
|
||||||
|
- await_only_futures
|
||||||
|
- camel_case_extensions
|
||||||
|
- camel_case_types
|
||||||
|
- cancel_subscriptions
|
||||||
|
- cascade_invocations
|
||||||
|
- cast_nullable_to_non_nullable
|
||||||
|
- collection_methods_unrelated_type
|
||||||
|
- combinators_ordering
|
||||||
|
- comment_references
|
||||||
|
- conditional_uri_does_not_exist
|
||||||
|
- constant_identifier_names
|
||||||
|
- control_flow_in_finally
|
||||||
|
- curly_braces_in_flow_control_structures
|
||||||
|
- depend_on_referenced_packages
|
||||||
|
- deprecated_consistency
|
||||||
|
- directives_ordering
|
||||||
|
- empty_catches
|
||||||
|
- empty_constructor_bodies
|
||||||
|
- empty_statements
|
||||||
|
- eol_at_end_of_file
|
||||||
|
- exhaustive_cases
|
||||||
|
- file_names
|
||||||
|
- flutter_style_todos
|
||||||
|
- hash_and_equals
|
||||||
|
- implementation_imports
|
||||||
|
- implicit_call_tearoffs
|
||||||
|
- iterable_contains_unrelated_type
|
||||||
|
- join_return_with_assignment
|
||||||
|
- leading_newlines_in_multiline_strings
|
||||||
|
- library_names
|
||||||
|
- library_prefixes
|
||||||
|
- library_private_types_in_public_api
|
||||||
|
- lines_longer_than_80_chars
|
||||||
|
- list_remove_unrelated_type
|
||||||
|
- literal_only_boolean_expressions
|
||||||
|
- missing_whitespace_between_adjacent_strings
|
||||||
|
- no_adjacent_strings_in_list
|
||||||
|
- no_default_cases
|
||||||
|
- no_duplicate_case_values
|
||||||
|
- no_leading_underscores_for_library_prefixes
|
||||||
|
- no_leading_underscores_for_local_identifiers
|
||||||
|
- no_runtimeType_toString
|
||||||
|
- non_constant_identifier_names
|
||||||
|
- noop_primitive_operations
|
||||||
|
- null_check_on_nullable_type_parameter
|
||||||
|
- null_closures
|
||||||
|
- one_member_abstracts
|
||||||
|
- only_throw_errors
|
||||||
|
- overridden_fields
|
||||||
|
- package_api_docs
|
||||||
|
- package_names
|
||||||
|
- package_prefixed_library_names
|
||||||
|
- parameter_assignments
|
||||||
|
- prefer_adjacent_string_concatenation
|
||||||
|
- prefer_asserts_in_initializer_lists
|
||||||
|
- prefer_asserts_with_message
|
||||||
|
- prefer_collection_literals
|
||||||
|
- prefer_conditional_assignment
|
||||||
|
- prefer_const_constructors
|
||||||
|
- prefer_const_constructors_in_immutables
|
||||||
|
- prefer_const_declarations
|
||||||
|
- prefer_const_literals_to_create_immutables
|
||||||
|
- prefer_constructors_over_static_methods
|
||||||
|
- prefer_contains
|
||||||
|
- prefer_equal_for_default_values
|
||||||
|
- prefer_expression_function_bodies
|
||||||
|
- prefer_final_fields
|
||||||
|
- prefer_final_in_for_each
|
||||||
|
- prefer_final_locals
|
||||||
|
- prefer_for_elements_to_map_fromIterable
|
||||||
|
- prefer_function_declarations_over_variables
|
||||||
|
- prefer_generic_function_type_aliases
|
||||||
|
- prefer_if_elements_to_conditional_expressions
|
||||||
|
- prefer_if_null_operators
|
||||||
|
- prefer_initializing_formals
|
||||||
|
- prefer_inlined_adds
|
||||||
|
- prefer_int_literals
|
||||||
|
- prefer_interpolation_to_compose_strings
|
||||||
|
- prefer_is_empty
|
||||||
|
- prefer_is_not_empty
|
||||||
|
- prefer_is_not_operator
|
||||||
|
- prefer_iterable_whereType
|
||||||
|
- prefer_mixin
|
||||||
|
- prefer_null_aware_method_calls
|
||||||
|
- prefer_null_aware_operators
|
||||||
|
- prefer_single_quotes
|
||||||
|
- prefer_spread_collections
|
||||||
|
- prefer_typing_uninitialized_variables
|
||||||
|
- prefer_void_to_null
|
||||||
|
- provide_deprecation_message
|
||||||
|
- recursive_getters
|
||||||
|
- require_trailing_commas
|
||||||
|
- slash_for_doc_comments
|
||||||
|
- sort_constructors_first
|
||||||
|
- sort_unnamed_constructors_first
|
||||||
|
- test_types_in_equals
|
||||||
|
- throw_in_finally
|
||||||
|
- tighten_type_of_initializing_formals
|
||||||
|
- type_annotate_public_apis
|
||||||
|
- type_init_formals
|
||||||
|
- unawaited_futures
|
||||||
|
- unnecessary_await_in_return
|
||||||
|
- unnecessary_brace_in_string_interps
|
||||||
|
- unnecessary_const
|
||||||
|
- unnecessary_constructor_name
|
||||||
|
- unnecessary_getters_setters
|
||||||
|
- unnecessary_lambdas
|
||||||
|
- unnecessary_late
|
||||||
|
- unnecessary_new
|
||||||
|
- unnecessary_null_aware_assignments
|
||||||
|
- unnecessary_null_checks
|
||||||
|
- unnecessary_null_in_if_null_operators
|
||||||
|
- unnecessary_nullable_for_final_variable_declarations
|
||||||
|
- unnecessary_overrides
|
||||||
|
- unnecessary_parenthesis
|
||||||
|
- unnecessary_raw_strings
|
||||||
|
- unnecessary_statements
|
||||||
|
- unnecessary_string_escapes
|
||||||
|
- unnecessary_string_interpolations
|
||||||
|
- unnecessary_this
|
||||||
|
- unnecessary_to_list_in_spreads
|
||||||
|
- unrelated_type_equality_checks
|
||||||
|
- unsafe_html
|
||||||
|
- use_enums
|
||||||
|
- use_function_type_syntax_for_parameters
|
||||||
|
- use_if_null_to_convert_nulls_to_bools
|
||||||
|
- use_is_even_rather_than_modulo
|
||||||
|
- use_late_for_private_fields_and_variables
|
||||||
|
- use_named_constants
|
||||||
|
- use_raw_strings
|
||||||
|
- use_rethrow_when_possible
|
||||||
|
- use_setters_to_change_properties
|
||||||
|
- use_string_buffers
|
||||||
|
- use_string_in_part_of_directives
|
||||||
|
- use_super_parameters
|
||||||
|
- use_test_throws_matchers
|
||||||
|
- use_to_and_as_if_applicable
|
||||||
|
- valid_regexps
|
||||||
|
- void_checks
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
include: package:wyatt_analysis/analysis_options.2.1.1.yaml
|
include: package:wyatt_analysis/analysis_options.2.2.0.yaml
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
include: package:wyatt_analysis/analysis_options.2.2.2.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- avoid_print
|
||||||
|
- avoid_unnecessary_containers
|
||||||
|
- avoid_web_libraries_in_flutter
|
||||||
|
- no_logic_in_create_state
|
||||||
|
- sized_box_for_whitespace
|
||||||
|
- sized_box_shrink_expand
|
||||||
|
- sort_child_properties_last
|
||||||
|
- use_build_context_synchronously
|
||||||
|
- use_colored_box
|
||||||
|
- use_decorated_box
|
||||||
|
- use_full_hex_values_for_flutter_colors
|
||||||
|
- use_key_in_widget_constructors
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# 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/>.
|
||||||
|
|
||||||
|
include: package:wyatt_analysis/analysis_options.2.3.0.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- avoid_print
|
||||||
|
- avoid_unnecessary_containers
|
||||||
|
- avoid_web_libraries_in_flutter
|
||||||
|
- no_logic_in_create_state
|
||||||
|
- sized_box_for_whitespace
|
||||||
|
- sized_box_shrink_expand
|
||||||
|
- sort_child_properties_last
|
||||||
|
- use_build_context_synchronously
|
||||||
|
- use_colored_box
|
||||||
|
- use_decorated_box
|
||||||
|
- use_full_hex_values_for_flutter_colors
|
||||||
|
- use_key_in_widget_constructors
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Copyright (C) 2023 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/>.
|
||||||
|
|
||||||
|
include: package:wyatt_analysis/analysis_options.2.4.0.yaml
|
||||||
|
|
||||||
|
linter:
|
||||||
|
rules:
|
||||||
|
- avoid_print
|
||||||
|
- avoid_unnecessary_containers
|
||||||
|
- avoid_web_libraries_in_flutter
|
||||||
|
- no_logic_in_create_state
|
||||||
|
- sized_box_for_whitespace
|
||||||
|
- sized_box_shrink_expand
|
||||||
|
- sort_child_properties_last
|
||||||
|
- use_build_context_synchronously
|
||||||
|
- use_colored_box
|
||||||
|
- use_decorated_box
|
||||||
|
- use_full_hex_values_for_flutter_colors
|
||||||
|
- use_key_in_widget_constructors
|
||||||
@@ -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
|
||||||
@@ -14,4 +14,5 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
include: package:wyatt_analysis/analysis_options.flutter.2.2.1.yaml
|
include: package:wyatt_analysis/analysis_options.flutter.2.4.0.yaml
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -14,4 +14,5 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
include: package:wyatt_analysis/analysis_options.2.2.1.yaml
|
include: package:wyatt_analysis/analysis_options.2.4.0.yaml
|
||||||
|
|
||||||
|
|||||||
@@ -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,8 +15,7 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/// Wyatt analyzer settings and best practices
|
/// Wyatt analyzer settings and best practices
|
||||||
/// used internally at [Wyatt](https://wyattapp.io)
|
/// used internally at [Wyatt Studio](https://wyatt-studio.fr).
|
||||||
/// and [Wyatt Studio](https://wyatt-studio.fr).
|
|
||||||
library wyatt_analysis;
|
library wyatt_analysis;
|
||||||
|
|
||||||
const String wyattAnalysisVersion = '2.2.1';
|
const String wyattAnalysisVersion = '2.4.0';
|
||||||
|
|||||||
Executable
+133
@@ -0,0 +1,133 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
usage="
|
||||||
|
usage:
|
||||||
|
$(basename "$0") <previous_version> <new_version> -- create new analyzer files.
|
||||||
|
|
||||||
|
where:
|
||||||
|
previous_version: last version, for example \`2.3.0\`
|
||||||
|
new_version: new version, for example \`2.4.0\`"
|
||||||
|
|
||||||
|
old=$1
|
||||||
|
new=$2
|
||||||
|
|
||||||
|
if [ -z "$old" ]; then
|
||||||
|
echo "previous_version cannot be null"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$new" ]; then
|
||||||
|
echo "new_version cannot be null"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_PATH="${BASH_SOURCE:-$0}"
|
||||||
|
ABS_SCRIPT_PATH="$(realpath "${SCRIPT_PATH}")"
|
||||||
|
ABS_DIRECTORY="$(dirname "${ABS_SCRIPT_PATH}")"
|
||||||
|
|
||||||
|
LIB="${ABS_DIRECTORY}/lib/wyatt_analysis.dart"
|
||||||
|
OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.yaml"
|
||||||
|
OLD_OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.${old}.yaml"
|
||||||
|
NEW_OPTIONS="${ABS_DIRECTORY}/lib/analysis_options.${new}.yaml"
|
||||||
|
|
||||||
|
OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.yaml"
|
||||||
|
OLD_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${old}.yaml"
|
||||||
|
NEW_OPTIONS_FLUTTER="${ABS_DIRECTORY}/lib/analysis_options.flutter.${new}.yaml"
|
||||||
|
|
||||||
|
if [ ! -e "$OLD_OPTIONS" ]; then
|
||||||
|
echo "analysis_options.${old}.yaml doesn't exists"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e "$OLD_OPTIONS_FLUTTER" ]; then
|
||||||
|
echo "analysis_options.flutter.${old}.yaml doesn't exists"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$NEW_OPTIONS" ]; then
|
||||||
|
echo "analysis_options.${new}.yaml already exists"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$NEW_OPTIONS_FLUTTER" ]; then
|
||||||
|
echo "analysis_options.flutter.${old}.yaml already exists"
|
||||||
|
echo "${usage}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy previous version files
|
||||||
|
cp "${OLD_OPTIONS}" "${NEW_OPTIONS}"
|
||||||
|
cp "${OLD_OPTIONS_FLUTTER}" "${NEW_OPTIONS_FLUTTER}"
|
||||||
|
|
||||||
|
# Search and replace old version string occurences in new files
|
||||||
|
sed -e "s/${old}/${new}/g" "${NEW_OPTIONS_FLUTTER}" > tempfile.tmp
|
||||||
|
mv -f tempfile.tmp "${NEW_OPTIONS_FLUTTER}"
|
||||||
|
|
||||||
|
sed -e "s/${old}/${new}/g" "${LIB}" > tempfile.tmp
|
||||||
|
mv -f tempfile.tmp "${LIB}"
|
||||||
|
|
||||||
|
sed -e "s/${old}/${new}/g" "README.md" > tempfile.tmp
|
||||||
|
mv -f tempfile.tmp "README.md"
|
||||||
|
|
||||||
|
echo "
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
include: package:wyatt_analysis/analysis_options.${new}.yaml
|
||||||
|
" > "${OPTIONS}"
|
||||||
|
|
||||||
|
echo "
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
include: package:wyatt_analysis/analysis_options.flutter.${new}.yaml
|
||||||
|
" > "${OPTIONS_FLUTTER}"
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -1,7 +1,23 @@
|
|||||||
|
# Copyright (C) 2023 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/>.
|
||||||
|
|
||||||
name: wyatt_analysis
|
name: wyatt_analysis
|
||||||
description: Lint rules for Dart and Flutter used internally at Wyatt and 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.2.2
|
version: 2.4.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
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
## 0.1.0+1
|
||||||
|
|
||||||
|
- Update a dependency to the latest release.
|
||||||
|
|
||||||
|
## 0.1.0
|
||||||
|
|
||||||
|
> Note: This release has breaking changes.
|
||||||
|
|
||||||
|
- **REFACTOR**: update naming methodes (close #47).
|
||||||
|
- **REFACTOR**: update example. (close #38).
|
||||||
|
- **FIX**: fix execute method on error handler. (#38).
|
||||||
|
- **FEAT**: update usecase en add & sepcific case. (#38).
|
||||||
|
- **FEAT**: add obsevers for alternative usecase scenarions (#38).
|
||||||
|
- **DOCS**: generate class model. (#38).
|
||||||
|
- **DOCS**: update Readme. (#38).
|
||||||
|
- **BREAKING** **CHORE**: update exports. (#38).
|
||||||
|
|
||||||
## 0.0.2
|
## 0.0.2
|
||||||
|
|
||||||
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
|
- Graduate package to a stable release. See pre-releases prior to this version for changelog entries.
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ The Wyatt Architecture for Flutter.
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Usecase
|
- Usecase
|
||||||
* Repository
|
- Repository
|
||||||
* DataSource
|
- DataSource
|
||||||
* Entity
|
- Entity
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -75,16 +75,17 @@ abstract class PhotoRepository extends BaseRepository {
|
|||||||
|
|
||||||
> Here the repository is just a proxy of the data sources with result type (to have beautiful error handling).
|
> Here the repository is just a proxy of the data sources with result type (to have beautiful error handling).
|
||||||
|
|
||||||
And finaly create your different usecases by using `UseCase<Parameters, ReturnType>` :
|
And finaly create your different usecases :
|
||||||
|
|
||||||
|
Several use cases are supported :
|
||||||
|
|
||||||
|
- Classic usecase :
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
class RetrieveAllPhoto extends UseCase<QueryParameters, List<Photo>> {
|
class Test extends AsyncUseCase<QueryParameters, List<Photo>>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
RetrieveAllPhotos(this._photoRepository);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> call(QueryParameters params) {
|
FuturOrResult<List<Photo>>> call(QueryParameters? params) {
|
||||||
final photos = _photoRepository.getAllPhotos(
|
final photos = _photoRepository.getAllPhotos(
|
||||||
start: params.start,
|
start: params.start,
|
||||||
limit: params.limit,
|
limit: params.limit,
|
||||||
@@ -94,6 +95,54 @@ class RetrieveAllPhoto extends UseCase<QueryParameters, List<Photo>> {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can add alternatve scenarios and check pre/post conditions using our extensions :
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class SearchPhotos extends AsyncUseCase<QueryParameters, List<Photo>>> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<List<Photo>>> call(QueryParameters? params) {
|
||||||
|
final photos = _photoRepository.getAllPhotos(
|
||||||
|
start: params.start,
|
||||||
|
limit: params.limit,
|
||||||
|
);
|
||||||
|
return photos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(QueryParameters? params) {
|
||||||
|
if(params.start == null || params.limit == null){
|
||||||
|
throw ClientException('Préconndition non valides');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can implement error scenarios overriding `onError`, or check postconditions by overriding `onComplete` .
|
||||||
|
|
||||||
|
- Stream usecase :
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class SearchPhotos extends StreamUseCase<QueryParameters, List<Photo>>> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<Stream<List<Photo>>>> call(QueryParameters? params) {
|
||||||
|
final photos = _photoRepository.getAllPhotos(
|
||||||
|
start: params.start,
|
||||||
|
limit: params.limit,
|
||||||
|
);
|
||||||
|
return photos;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
On this case, observers allow you to add alternative scénarios when data changed, overriding `onData` or `onDone`.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
|
|||||||
+1
-2
@@ -24,9 +24,8 @@ import 'package:wyatt_http_client/wyatt_http_client.dart';
|
|||||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||||
|
|
||||||
class AlbumApiDataSourceImpl extends AlbumRemoteDataSource {
|
class AlbumApiDataSourceImpl extends AlbumRemoteDataSource {
|
||||||
final MiddlewareClient _client;
|
|
||||||
|
|
||||||
AlbumApiDataSourceImpl(this._client);
|
AlbumApiDataSourceImpl(this._client);
|
||||||
|
final MiddlewareClient _client;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Album> getAlbum(int id) async {
|
Future<Album> getAlbum(int id) async {
|
||||||
|
|||||||
+1
-2
@@ -24,9 +24,8 @@ import 'package:wyatt_http_client/wyatt_http_client.dart';
|
|||||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||||
|
|
||||||
class PhotoApiDataSourceImpl extends PhotoRemoteDataSource {
|
class PhotoApiDataSourceImpl extends PhotoRemoteDataSource {
|
||||||
final MiddlewareClient _client;
|
|
||||||
|
|
||||||
PhotoApiDataSourceImpl(this._client);
|
PhotoApiDataSourceImpl(this._client);
|
||||||
|
final MiddlewareClient _client;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Photo> getPhoto(int id) async {
|
Future<Photo> getPhoto(int id) async {
|
||||||
|
|||||||
+13
-12
@@ -24,57 +24,58 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
|
|||||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||||
|
|
||||||
class PhotoRepositoryImpl extends PhotoRepository {
|
class PhotoRepositoryImpl extends PhotoRepository {
|
||||||
final PhotoRemoteDataSource _photoRemoteDataSource;
|
|
||||||
final AlbumRemoteDataSource _albumRemoteDataSource;
|
|
||||||
final FavoriteLocalDataSource _favoriteLocalDataSource;
|
|
||||||
|
|
||||||
PhotoRepositoryImpl(
|
PhotoRepositoryImpl(
|
||||||
this._photoRemoteDataSource,
|
this._photoRemoteDataSource,
|
||||||
this._albumRemoteDataSource,
|
this._albumRemoteDataSource,
|
||||||
this._favoriteLocalDataSource,
|
this._favoriteLocalDataSource,
|
||||||
);
|
);
|
||||||
|
final PhotoRemoteDataSource _photoRemoteDataSource;
|
||||||
|
final AlbumRemoteDataSource _albumRemoteDataSource;
|
||||||
|
final FavoriteLocalDataSource _favoriteLocalDataSource;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<void> addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
|
FutureOrResult<void> addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
|
||||||
() => _favoriteLocalDataSource.addPhotoToFavorites(photo),
|
() => _favoriteLocalDataSource.addPhotoToFavorites(photo),
|
||||||
(error) => ClientException('Cannot add photo to favorites.'),
|
(error) => ClientException('Cannot add photo to favorites.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<bool> checkIfPhotoIsInFavorites(int id) => Result.tryCatchAsync(
|
FutureOrResult<bool> checkIfPhotoIsInFavorites(int id) =>
|
||||||
|
Result.tryCatchAsync(
|
||||||
() => _favoriteLocalDataSource.checkIfPhotoIsInFavorites(id),
|
() => _favoriteLocalDataSource.checkIfPhotoIsInFavorites(id),
|
||||||
(error) =>
|
(error) =>
|
||||||
ClientException('Cannot check if photo `$id` is in favorites.'),
|
ClientException('Cannot check if photo `$id` is in favorites.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<void> deletePhotoFromFavorites(int id) => Result.tryCatchAsync(
|
FutureOrResult<void> deletePhotoFromFavorites(int id) => Result.tryCatchAsync(
|
||||||
() => _favoriteLocalDataSource.deletePhotoFromFavorites(id),
|
() => _favoriteLocalDataSource.deletePhotoFromFavorites(id),
|
||||||
(error) => ClientException('Cannot delete photo `$id` from favorites.'),
|
(error) => ClientException('Cannot delete photo `$id` from favorites.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<Album> getAlbum(int id) => Result.tryCatchAsync(
|
FutureOrResult<Album> getAlbum(int id) => Result.tryCatchAsync(
|
||||||
() => _albumRemoteDataSource.getAlbum(id),
|
() => _albumRemoteDataSource.getAlbum(id),
|
||||||
(error) => ServerException('Cannot retrieve album $id.'),
|
(error) => ServerException('Cannot retrieve album $id.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Album>> getAllAlbums({int? start, int? limit}) =>
|
FutureOrResult<List<Album>> getAllAlbums({int? start, int? limit}) =>
|
||||||
Result.tryCatchAsync(
|
Result.tryCatchAsync(
|
||||||
() => _albumRemoteDataSource.getAllAlbums(start: start, limit: limit),
|
() => _albumRemoteDataSource.getAllAlbums(start: start, limit: limit),
|
||||||
(error) => ServerException('Cannot retrieve all albums.'),
|
(error) => ServerException('Cannot retrieve all albums.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> getAllPhotos({int? start, int? limit}) async =>
|
FutureOrResult<List<Photo>> getAllPhotos({int? start, int? limit}) async =>
|
||||||
Result.tryCatchAsync(
|
Result.tryCatchAsync(
|
||||||
() => _photoRemoteDataSource.getAllPhotos(start: start, limit: limit),
|
() => _photoRemoteDataSource.getAllPhotos(start: start, limit: limit),
|
||||||
(error) => ServerException('Cannot retrieve all photos.'),
|
(error) => ServerException('Cannot retrieve all photos.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> getAllPhotosFromFavorites() async {
|
FutureOrResult<List<Photo>> getAllPhotosFromFavorites() async {
|
||||||
try {
|
try {
|
||||||
final response = <Photo>[];
|
final response = <Photo>[];
|
||||||
final favorites =
|
final favorites =
|
||||||
@@ -95,13 +96,13 @@ class PhotoRepositoryImpl extends PhotoRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<Photo> getPhoto(int id) => Result.tryCatchAsync(
|
FutureOrResult<Photo> getPhoto(int id) => Result.tryCatchAsync(
|
||||||
() => _photoRemoteDataSource.getPhoto(id),
|
() => _photoRemoteDataSource.getPhoto(id),
|
||||||
(error) => ServerException('Cannot retrieve photo $id.'),
|
(error) => ServerException('Cannot retrieve photo $id.'),
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> getPhotosFromAlbum(
|
FutureOrResult<List<Photo>> getPhotosFromAlbum(
|
||||||
int albumId, {
|
int albumId, {
|
||||||
int? start,
|
int? start,
|
||||||
int? limit,
|
int? limit,
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ import 'package:architecture_example/domain/entities/photo.dart';
|
|||||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||||
|
|
||||||
abstract class PhotoRepository extends BaseRepository {
|
abstract class PhotoRepository extends BaseRepository {
|
||||||
FutureResult<Album> getAlbum(int id);
|
FutureOrResult<Album> getAlbum(int id);
|
||||||
FutureResult<List<Album>> getAllAlbums({int? start, int? limit});
|
FutureOrResult<List<Album>> getAllAlbums({int? start, int? limit});
|
||||||
FutureResult<Photo> getPhoto(int id);
|
FutureOrResult<Photo> getPhoto(int id);
|
||||||
FutureResult<List<Photo>> getAllPhotos({int? start, int? limit});
|
FutureOrResult<List<Photo>> getAllPhotos({int? start, int? limit});
|
||||||
FutureResult<List<Photo>> getPhotosFromAlbum(
|
FutureOrResult<List<Photo>> getPhotosFromAlbum(
|
||||||
int albumId, {
|
int albumId, {
|
||||||
int? start,
|
int? start,
|
||||||
int? limit,
|
int? limit,
|
||||||
});
|
});
|
||||||
FutureResult<void> addPhotoToFavorites(Photo photo);
|
FutureOrResult<void> addPhotoToFavorites(Photo photo);
|
||||||
FutureResult<void> deletePhotoFromFavorites(int id);
|
FutureOrResult<void> deletePhotoFromFavorites(int id);
|
||||||
FutureResult<List<Photo>> getAllPhotosFromFavorites();
|
FutureOrResult<List<Photo>> getAllPhotosFromFavorites();
|
||||||
FutureResult<bool> checkIfPhotoIsInFavorites(int id);
|
FutureOrResult<bool> checkIfPhotoIsInFavorites(int id);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-4
@@ -14,18 +14,27 @@
|
|||||||
// 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 UseCase<Photo, List<Photo>> {
|
class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
AddPhotoToFavorites(this._photoRepository);
|
AddPhotoToFavorites(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> call(Photo params) async {
|
FutureOrResult<List<Photo>> execute(Photo? params) async {
|
||||||
await _photoRepository.addPhotoToFavorites(params);
|
await _photoRepository.addPhotoToFavorites(params!);
|
||||||
return _photoRepository.getAllPhotosFromFavorites();
|
return _photoRepository.getAllPhotosFromFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(Photo? params) {
|
||||||
|
if (params == null) {
|
||||||
|
throw ClientException('Photo cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-4
@@ -14,15 +14,24 @@
|
|||||||
// 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 UseCase<int, bool> {
|
class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
CheckIfPhotoIsInFavorites(this._photoRepository);
|
CheckIfPhotoIsInFavorites(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<bool> call(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 ClientException('id cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -18,13 +18,13 @@ 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 UseCase<void, List<Photo>> {
|
class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
DisplayFavorites(this._photoRepository);
|
DisplayFavorites(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> call(void params) {
|
FutureOrResult<List<Photo>> execute(void params) {
|
||||||
final photos = _photoRepository.getAllPhotosFromFavorites();
|
final photos = _photoRepository.getAllPhotosFromFavorites();
|
||||||
return photos;
|
return photos;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,18 +14,27 @@
|
|||||||
// 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 UseCase<int, Photo> {
|
class DisplayPhoto extends AsyncUseCase<int, Photo> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
DisplayPhoto(this._photoRepository);
|
DisplayPhoto(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<Photo> call(int params) {
|
FutureOrResult<Photo> execute(int? params) {
|
||||||
final photo = _photoRepository.getPhoto(params);
|
final photo = _photoRepository.getPhoto(params!);
|
||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(int? params) {
|
||||||
|
if (params == null) {
|
||||||
|
throw ClientException('id cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,24 +14,33 @@
|
|||||||
// 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 UseCase<QueryParameters, List<Photo>> {
|
class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
OpenAlbum(this._photoRepository);
|
OpenAlbum(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> call(QueryParameters params) {
|
FutureOrResult<List<Photo>> execute(QueryParameters? params) {
|
||||||
final photos = _photoRepository.getPhotosFromAlbum(
|
final photos = _photoRepository.getPhotosFromAlbum(
|
||||||
params.albumId,
|
params!.albumId,
|
||||||
start: params.start,
|
start: params.start,
|
||||||
limit: params.limit,
|
limit: params.limit,
|
||||||
);
|
);
|
||||||
|
|
||||||
return photos;
|
return photos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(QueryParameters? params) {
|
||||||
|
if (params == null) {
|
||||||
|
throw ClientException('params cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -15,9 +15,9 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
class QueryParameters {
|
class QueryParameters {
|
||||||
|
|
||||||
|
QueryParameters(this.start, this.limit, {this.albumId = -1});
|
||||||
final int albumId;
|
final int albumId;
|
||||||
final int? start;
|
final int? start;
|
||||||
final int? limit;
|
final int? limit;
|
||||||
|
|
||||||
QueryParameters(this.start, this.limit, {this.albumId = -1});
|
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-4
@@ -14,18 +14,27 @@
|
|||||||
// 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 UseCase<int, List<Photo>> {
|
class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
RemovePhotoFromFavorites(this._photoRepository);
|
RemovePhotoFromFavorites(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Photo>> call(int params) async {
|
FutureOrResult<List<Photo>> execute(int? params) async {
|
||||||
await _photoRepository.deletePhotoFromFavorites(params);
|
await _photoRepository.deletePhotoFromFavorites(params!);
|
||||||
return _photoRepository.getAllPhotosFromFavorites();
|
return _photoRepository.getAllPhotosFromFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(int? params) {
|
||||||
|
if (params == null) {
|
||||||
|
throw ClientException('id cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-4
@@ -14,22 +14,31 @@
|
|||||||
// 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 UseCase<QueryParameters, List<Album>> {
|
class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
|
||||||
final PhotoRepository _photoRepository;
|
|
||||||
|
|
||||||
RetrieveAllAlbums(this._photoRepository);
|
RetrieveAllAlbums(this._photoRepository);
|
||||||
|
final PhotoRepository _photoRepository;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FutureResult<List<Album>> call(QueryParameters params) {
|
FutureOrResult<List<Album>> execute(QueryParameters? params) {
|
||||||
final albums = _photoRepository.getAllAlbums(
|
final albums = _photoRepository.getAllAlbums(
|
||||||
start: params.start,
|
start: params!.start,
|
||||||
limit: params.limit,
|
limit: params.limit,
|
||||||
);
|
);
|
||||||
return albums;
|
return albums;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOr<void> onStart(QueryParameters? params) {
|
||||||
|
if (params == null) {
|
||||||
|
throw ClientException('params cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,6 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
|
|||||||
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
||||||
|
|
||||||
class AlbumBloc extends Bloc<AlbumEvent, AlbumState> {
|
class AlbumBloc extends Bloc<AlbumEvent, AlbumState> {
|
||||||
final RetrieveAllAlbums _retrieveAllAlbums;
|
|
||||||
|
|
||||||
AlbumBloc(this._retrieveAllAlbums) : super(const AlbumState()) {
|
AlbumBloc(this._retrieveAllAlbums) : super(const AlbumState()) {
|
||||||
on<AlbumFetched>(
|
on<AlbumFetched>(
|
||||||
@@ -41,6 +40,7 @@ class AlbumBloc extends Bloc<AlbumEvent, AlbumState> {
|
|||||||
transformer: throttleDroppable(throttleDuration),
|
transformer: throttleDroppable(throttleDuration),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
final RetrieveAllAlbums _retrieveAllAlbums;
|
||||||
|
|
||||||
Future<void> _onAlbumFetched(
|
Future<void> _onAlbumFetched(
|
||||||
AlbumFetched event,
|
AlbumFetched event,
|
||||||
|
|||||||
+3
-3
@@ -26,19 +26,19 @@ abstract class PhotoDetailsState extends Equatable {
|
|||||||
class PhotoDetailsInitial extends PhotoDetailsState {}
|
class PhotoDetailsInitial extends PhotoDetailsState {}
|
||||||
|
|
||||||
class PhotoDetailsSuccess extends PhotoDetailsState {
|
class PhotoDetailsSuccess extends PhotoDetailsState {
|
||||||
final Photo photo;
|
|
||||||
final bool isFavorite;
|
|
||||||
|
|
||||||
const PhotoDetailsSuccess(this.photo, {required this.isFavorite});
|
const PhotoDetailsSuccess(this.photo, {required this.isFavorite});
|
||||||
|
final Photo photo;
|
||||||
|
final bool isFavorite;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [photo, isFavorite];
|
List<Object> get props => [photo, isFavorite];
|
||||||
}
|
}
|
||||||
|
|
||||||
class PhotoDetailsFailure extends PhotoDetailsState {
|
class PhotoDetailsFailure extends PhotoDetailsState {
|
||||||
final String error;
|
|
||||||
|
|
||||||
const PhotoDetailsFailure(this.error);
|
const PhotoDetailsFailure(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [error];
|
List<Object> get props => [error];
|
||||||
|
|||||||
+1
-1
@@ -23,10 +23,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
part 'favorite_checker_state.dart';
|
part 'favorite_checker_state.dart';
|
||||||
|
|
||||||
class FavoriteCheckerCubit extends Cubit<FavoriteCheckerState> {
|
class FavoriteCheckerCubit extends Cubit<FavoriteCheckerState> {
|
||||||
final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
|
|
||||||
|
|
||||||
FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites)
|
FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites)
|
||||||
: super(FavoriteCheckerInitial());
|
: super(FavoriteCheckerInitial());
|
||||||
|
final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
|
||||||
|
|
||||||
FutureOr<void> checkIfPhotoIsInFavorites(int photoId) async {
|
FutureOr<void> checkIfPhotoIsInFavorites(int photoId) async {
|
||||||
final response = await _checkIfPhotoIsInFavorites.call(photoId);
|
final response = await _checkIfPhotoIsInFavorites.call(photoId);
|
||||||
|
|||||||
+3
-3
@@ -10,19 +10,19 @@ abstract class FavoriteCheckerState extends Equatable {
|
|||||||
class FavoriteCheckerInitial extends FavoriteCheckerState {}
|
class FavoriteCheckerInitial extends FavoriteCheckerState {}
|
||||||
|
|
||||||
class FavoriteCheckerSuccess extends FavoriteCheckerState {
|
class FavoriteCheckerSuccess extends FavoriteCheckerState {
|
||||||
final int photoId;
|
|
||||||
final bool isFavorite;
|
|
||||||
|
|
||||||
const FavoriteCheckerSuccess(this.photoId, {required this.isFavorite});
|
const FavoriteCheckerSuccess(this.photoId, {required this.isFavorite});
|
||||||
|
final int photoId;
|
||||||
|
final bool isFavorite;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [photoId, isFavorite];
|
List<Object> get props => [photoId, isFavorite];
|
||||||
}
|
}
|
||||||
|
|
||||||
class FavoriteCheckerFailure extends FavoriteCheckerState {
|
class FavoriteCheckerFailure extends FavoriteCheckerState {
|
||||||
final String error;
|
|
||||||
|
|
||||||
const FavoriteCheckerFailure(this.error);
|
const FavoriteCheckerFailure(this.error);
|
||||||
|
final String error;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object> get props => [error];
|
List<Object> get props => [error];
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,6 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
|
|||||||
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
||||||
|
|
||||||
class PhotoBloc extends Bloc<PhotoEvent, PhotoState> {
|
class PhotoBloc extends Bloc<PhotoEvent, PhotoState> {
|
||||||
final OpenAlbum _openAlbum;
|
|
||||||
|
|
||||||
PhotoBloc(this._openAlbum) : super(const PhotoState()) {
|
PhotoBloc(this._openAlbum) : super(const PhotoState()) {
|
||||||
on<PhotoFetched>(
|
on<PhotoFetched>(
|
||||||
@@ -41,6 +40,7 @@ class PhotoBloc extends Bloc<PhotoEvent, PhotoState> {
|
|||||||
transformer: throttleDroppable(throttleDuration),
|
transformer: throttleDroppable(throttleDuration),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
final OpenAlbum _openAlbum;
|
||||||
|
|
||||||
Future<void> _onPhotoFetched(
|
Future<void> _onPhotoFetched(
|
||||||
PhotoFetched event,
|
PhotoFetched event,
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ abstract class PhotoEvent extends Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PhotoFetched extends PhotoEvent {
|
class PhotoFetched extends PhotoEvent {
|
||||||
final int albumId;
|
|
||||||
|
|
||||||
const PhotoFetched(this.albumId);
|
const PhotoFetched(this.albumId);
|
||||||
|
final int albumId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,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.3+1
|
version: ^0.0.4
|
||||||
|
|
||||||
wyatt_http_client:
|
wyatt_http_client:
|
||||||
git:
|
git:
|
||||||
@@ -49,7 +49,7 @@ dependencies:
|
|||||||
|
|
||||||
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: ^1.2.0
|
version: ^2.0.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.2.0
|
||||||
@@ -67,7 +67,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.4.0
|
||||||
path: packages/wyatt_analysis
|
path: packages/wyatt_analysis
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||||
|
|
||||||
abstract class AppException implements Exception {
|
abstract class AppException implements Exception {
|
||||||
final String? message;
|
|
||||||
|
|
||||||
AppException([this.message]);
|
AppException([this.message]);
|
||||||
|
final String? message;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// 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/wyatt_architecture.dart';
|
||||||
|
|
||||||
|
/// Usecase observers
|
||||||
|
mixin Observer<Parameters, ReturnType> {
|
||||||
|
/// Called before usecase is runned.
|
||||||
|
/// Usefull to check the preconditions
|
||||||
|
FutureOr<void> onStart(Parameters? params) {}
|
||||||
|
|
||||||
|
/// Called when error occures during main scenario
|
||||||
|
/// Usefull to run alternative scenario
|
||||||
|
FutureOr<void> onError(AppException? error) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specific observer for classic usecase
|
||||||
|
mixin AsyncObserver<ReturnType> {
|
||||||
|
FutureOr<void> onComplete(ReturnType? data) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Specific observer for stream case usecase
|
||||||
|
mixin StreamObserver<ReturnType> {
|
||||||
|
/// Replaces the data event handler of this subscription.
|
||||||
|
void onDone() {}
|
||||||
|
|
||||||
|
/// Replaces the done event handler of this subscription.
|
||||||
|
void onData(ReturnType? data) {}
|
||||||
|
}
|
||||||
@@ -14,14 +14,67 @@
|
|||||||
// 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:wyatt_architecture/src/core/exceptions/exceptions.dart';
|
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';
|
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||||
|
|
||||||
typedef FutureResult<T> = Future<Result<T, AppException>>;
|
typedef FutureOrResult<T> = FutureOr<Result<T, AppException>>;
|
||||||
typedef StreamResult<T> = Stream<Result<T, AppException>>;
|
typedef StreamResult<T> = Stream<Result<T, AppException>>;
|
||||||
typedef Res<T> = Result<T, AppException>;
|
|
||||||
|
|
||||||
// ignore: one_member_abstracts
|
/// Abstract class of a use case
|
||||||
abstract class UseCase<Parameters, ReturnType> {
|
abstract class BaseUseCase<Parameters, ReturnType> {
|
||||||
FutureResult<ReturnType> call(Parameters params);
|
/// Run use case scenarios
|
||||||
|
ReturnType call(Parameters parameters);
|
||||||
|
|
||||||
|
/// Private function to implement main scenario
|
||||||
|
/// of your usecase.
|
||||||
|
ReturnType execute(Parameters params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Abstract class of a use case that deals specifically
|
||||||
|
/// with the response and its state.
|
||||||
|
abstract class UseCase<Parameters, ReturnType>
|
||||||
|
extends BaseUseCase<Parameters?, FutureOrResult<ReturnType>>
|
||||||
|
with Observer<Parameters, ReturnType> {
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Abtstract classic usecase.
|
||||||
|
abstract class AsyncUseCase<Parameters, ReturnType>
|
||||||
|
extends UseCase<Parameters?, ReturnType> with AsyncObserver<ReturnType> {
|
||||||
|
@override
|
||||||
|
FutureOr<void> _onSuccess(ReturnType data) => onComplete(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Abstract specific usecase bases on streams
|
||||||
|
abstract class StreamUseCase<Parameters, ReturnType>
|
||||||
|
extends UseCase<Parameters?, Stream<ReturnType>>
|
||||||
|
with StreamObserver<ReturnType> {
|
||||||
|
@override
|
||||||
|
FutureOr<void> _onSuccess(Stream<ReturnType> data) {
|
||||||
|
data.listen(
|
||||||
|
onData,
|
||||||
|
onDone: onDone,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 'no_param.dart';
|
export 'no_param.dart';
|
||||||
|
export 'observers.dart';
|
||||||
export 'usecase.dart';
|
export 'usecase.dart';
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 117 KiB |
@@ -0,0 +1,86 @@
|
|||||||
|
@startuml
|
||||||
|
set namespaceSeparator ::
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" {
|
||||||
|
+String? message
|
||||||
|
+String toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
"dart::core::Exception" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::AppException"
|
||||||
|
|
||||||
|
class "wyatt_architecture::src::core::exceptions::exceptions.dart::ClientException" {
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::ClientException"
|
||||||
|
class "wyatt_architecture::src::core::exceptions::exceptions.dart::ServerException" {
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::core::exceptions::exceptions.dart::AppException" <|-- "wyatt_architecture::src::core::exceptions::exceptions.dart::ServerException"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::repositories::base_repository.dart::BaseRepository" {
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::data_sources::local::base_local_data_source.dart::BaseLocalDataSource" {
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" <|-- "wyatt_architecture::src::domain::data_sources::local::base_local_data_source.dart::BaseLocalDataSource"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" {
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::data_sources::remote::base_remote_data_source.dart::BaseRemoteDataSource" {
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::data_sources::base_data_source.dart::BaseDataSource" <|-- "wyatt_architecture::src::domain::data_sources::remote::base_remote_data_source.dart::BaseRemoteDataSource"
|
||||||
|
|
||||||
|
class "wyatt_architecture::src::domain::usecases::no_param.dart::NoParam" {
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::entities::entity.dart::Entity" <|-- "wyatt_architecture::src::domain::usecases::no_param.dart::NoParam"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::Observer" {
|
||||||
|
+FutureOr<void> onStart()
|
||||||
|
+FutureOr<void> onError()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::AsyncObserver" {
|
||||||
|
+FutureOr<void> onComplete()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::observers.dart::StreamObserver" {
|
||||||
|
+void onDone()
|
||||||
|
+void onData()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::BaseUseCase" {
|
||||||
|
+ReturnType execute()
|
||||||
|
+ReturnType call()
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" {
|
||||||
|
-FutureOr<void> _onSuccess()
|
||||||
|
+FutureOr<Result<ReturnType, AppException>> execute()
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::usecases::usecase.dart::BaseUseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase"
|
||||||
|
"wyatt_architecture::src::domain::usecases::observers.dart::Observer" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::UseCase"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase" {
|
||||||
|
-FutureOr<void> _onSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase"
|
||||||
|
"wyatt_architecture::src::domain::usecases::observers.dart::AsyncObserver" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::AsyncUseCase"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase" {
|
||||||
|
-FutureOr<void> _onSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
"wyatt_architecture::src::domain::usecases::usecase.dart::UseCase" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase"
|
||||||
|
"wyatt_architecture::src::domain::usecases::observers.dart::StreamObserver" <|-- "wyatt_architecture::src::domain::usecases::usecase.dart::StreamUseCase"
|
||||||
|
|
||||||
|
abstract class "wyatt_architecture::src::domain::entities::entity.dart::Entity" {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@enduml
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
name: wyatt_architecture
|
name: wyatt_architecture
|
||||||
description: A new Wyatt package
|
description: A new Wyatt package
|
||||||
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.0.2
|
version: 0.1.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
|
||||||
|
|
||||||
@@ -15,7 +15,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.3+1
|
version: ^0.0.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
||||||
@@ -24,4 +24,4 @@ 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.4.0
|
||||||
@@ -23,7 +23,6 @@
|
|||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
|
||||||
/pubspec.lock
|
/pubspec.lock
|
||||||
**/doc/api/
|
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.packages
|
.packages
|
||||||
build/
|
build/
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
firebase_options.dart
|
||||||
|
.vscode
|
||||||
@@ -1,4 +1,10 @@
|
|||||||
{
|
{
|
||||||
|
// Dart
|
||||||
|
"dart.runPubGetOnPubspecChanges": "never",
|
||||||
|
// Gitea
|
||||||
|
"gitea.owner": "Wyatt-FOSS",
|
||||||
|
"gitea.repo": "wyatt-packages",
|
||||||
|
// Header
|
||||||
"psi-header.changes-tracking": {
|
"psi-header.changes-tracking": {
|
||||||
"isActive": true
|
"isActive": true
|
||||||
},
|
},
|
||||||
@@ -67,5 +73,4 @@
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dart.runPubGetOnPubspecChanges": false,
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,50 @@
|
|||||||
|
## 0.4.1
|
||||||
|
|
||||||
|
- **REFACTOR**: use fromFirebaseUser factory to parse user.
|
||||||
|
- **REFACTOR**: update deps and re-export them.
|
||||||
|
- **FIX**: fix mock on register.
|
||||||
|
- **FEAT**: add google sign in in signIn cubit.
|
||||||
|
- **FEAT**: add google sign in parameter in firebase data source constructor.
|
||||||
|
- **FEAT**: add google sign_in support (closes #59).
|
||||||
|
- **FEAT**: add reauthenticate, updateEmail and updatePassword.
|
||||||
|
- **DOCS**: add correct header.
|
||||||
|
|
||||||
|
## 0.4.0+3
|
||||||
|
|
||||||
|
- Update a dependency to the latest release.
|
||||||
|
|
||||||
|
## 0.4.0+2
|
||||||
|
|
||||||
|
- Update a dependency to the latest release.
|
||||||
|
|
||||||
|
## 0.4.0+1
|
||||||
|
|
||||||
|
- **FIX**: add sort of mutex on onAuthChanges callback trigger.
|
||||||
|
|
||||||
|
## 0.4.0
|
||||||
|
|
||||||
|
> Note: This release has breaking changes.
|
||||||
|
|
||||||
|
- **REFACTOR**: update example with new input builders.
|
||||||
|
- **FIX**: add initial null account event in stream in the mock authentication.
|
||||||
|
- **BREAKING** **FIX**: add signInWithEmailAndPassword and signInAnonymously methods in SignInCubit #26.
|
||||||
|
|
||||||
|
## 0.3.0+1
|
||||||
|
|
||||||
|
- **FIX**: fix some bugs to validate publishing.
|
||||||
|
|
||||||
|
## 0.3.0
|
||||||
|
|
||||||
|
> Note: This release has breaking changes.
|
||||||
|
|
||||||
|
- **REFACTOR**: use correct deps.
|
||||||
|
- **REFACTOR**: update example with new listeners.
|
||||||
|
- **FIX**: return exception and not throwing it anymore.
|
||||||
|
- **FIX**: exception returns msg as message.
|
||||||
|
- **FEAT**: add fully functionnal mock data source.
|
||||||
|
- **FEAT**: add toString and equality on entities and models.
|
||||||
|
- **BREAKING** **FEAT**: add email verification, password reset support.
|
||||||
|
|
||||||
## 0.2.1+6
|
## 0.2.1+6
|
||||||
|
|
||||||
- Update a dependency to the latest release.
|
- Update a dependency to the latest release.
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -19,9 +19,7 @@
|
|||||||
# Flutter - Authentication BLoC
|
# Flutter - Authentication BLoC
|
||||||
|
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis">
|
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a>
|
||||||
<img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" />
|
|
||||||
</a>
|
|
||||||
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
|
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -29,275 +27,195 @@ Authentication Bloc for Flutter.
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- UserInterface
|
* 🧐 Wyatt Architecture
|
||||||
* UserFirebase : FirebaseAuth user implementation
|
* 🧱 Entities
|
||||||
- AuthenticationRepositoryInterface
|
- Account -> Contains account information from provider.
|
||||||
* AuthenticationRepositoryFirebase : FirebaseAuth implementation
|
- Session -> Contains account and associated data retrieved from an external source.
|
||||||
- ExceptionsInterface
|
- AuthenticationChangeEvent -> Describes an event in authentication change (sign in, sign up, sign out, etc...)
|
||||||
* ExceptionsFirebase : FirebaseAuth Exception parsing implementation
|
- SessionWrapper -> Contains latest authentication change event and session.
|
||||||
- AuthenticationBloc
|
* 🔑 Powerful and secured authentication repository
|
||||||
* Tracks every user changes
|
* 🔥 Multiple data sources
|
||||||
- Right after the listener has been registered.
|
- Mock
|
||||||
- When a user is signed in.
|
- Firebase
|
||||||
- When the current user is signed out.
|
* 🧊 Cubits, why make it complicated when you can make it simple?
|
||||||
- When there is a change in the current user's token.
|
- Goes to the essential.
|
||||||
- On `refresh()`
|
* 📐 Consistent
|
||||||
* Start/Stop listening on demand
|
- Every class have same naming convention
|
||||||
- `start()` to listen to user changes
|
* 🧪 Tested
|
||||||
- `stop()` to cancel listener
|
* 📚 Documented: [available here](./doc/api/index.md)
|
||||||
- SignUpCubit
|
|
||||||
* Handles email/password validation and password confirmation
|
|
||||||
* Handles register with email/password
|
|
||||||
* Handles custom form fields thanks `wyatt_form_bloc`
|
|
||||||
- Use `entries` to pass a `FormData` object
|
|
||||||
- You can use several pre configured `FormInput` for validation
|
|
||||||
- You can use `updateFormData()` to change FormData and validators during runtime (intersection, union, difference or replace)
|
|
||||||
- SignInCubit
|
|
||||||
* Handles email/password validation
|
|
||||||
* Handles login with email/password
|
|
||||||
- EmailVerificationCubit
|
|
||||||
* Handles send email verification process
|
|
||||||
* Handles email verification check
|
|
||||||
- PasswordResetCubit
|
|
||||||
* Handles send password reset email process
|
|
||||||
- Builders
|
|
||||||
* AuthenticationBuilder to build widgets on user state changes
|
|
||||||
- Consistent
|
|
||||||
* Every class have same naming convention
|
|
||||||
- Tested
|
|
||||||
* Partially tested with *bloc_test*
|
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
|
|
||||||
Simply add `wyatt_authentication_bloc` in `pubspec.yaml`, then
|
Simply add `wyatt_authentication_bloc` in `pubspec.yaml` , then
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
### Data source
|
||||||
|
|
||||||
Create an authentication repository:
|
The first step is to provide a data source.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
final AuthenticationRepositoryInterface _authenticationRepository = AuthenticationRepositoryFirebase();
|
getIt.registerLazySingleton<AuthenticationRemoteDataSource<int>>(
|
||||||
```
|
() => AuthenticationFirebaseDataSourceImpl<int>(
|
||||||
|
firebaseAuth: FirebaseAuth.instance,
|
||||||
Create an authentication cubit:
|
googleSignIn:
|
||||||
|
GoogleSignIn(clientId: DefaultFirebaseOptions.ios.iosClientId)),
|
||||||
```dart
|
|
||||||
final AuthenticationCubit _authenticationCubit = AuthenticationCubit(
|
|
||||||
authenticationRepository: _authenticationRepository,
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a sign up cubit:
|
> Here we use GetIt (see example project)
|
||||||
|
|
||||||
|
### Repository
|
||||||
|
|
||||||
|
Then you can configure your repository.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
final SignUpCubit _signUpCubit = SignUpCubit(
|
final AuthenticationRepository<int> authenticationRepository = AuthenticationRepositoryImpl(
|
||||||
authenticationRepository: _authenticationRepository,
|
authenticationRemoteDataSource:
|
||||||
authenticationCubit: _authenticationCubit,
|
getIt<AuthenticationRemoteDataSource<int>>(),
|
||||||
);
|
customPasswordValidator: const CustomPassword.pure(),
|
||||||
```
|
extraSignUpInputs: [
|
||||||
|
FormInput(
|
||||||
You can use `AuthenticationBloc` to route your app.
|
AuthFormField.confirmPassword,
|
||||||
|
const ConfirmedPassword.pure(),
|
||||||
```dart
|
metadata: const FormInputMetadata<void>(export: false),
|
||||||
return MultiRepositoryProvider(
|
|
||||||
providers: [
|
|
||||||
RepositoryProvider<AuthenticationRepositoryInterface>(
|
|
||||||
create: (context) => _authenticationRepository,
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: MultiBlocProvider(
|
|
||||||
providers: [
|
|
||||||
BlocProvider<AuthenticationCubit>(
|
|
||||||
create: (context) => _authenticationCubit..init(),
|
|
||||||
),
|
|
||||||
BlocProvider<SignUpCubit>(
|
|
||||||
create: (context) => _signUpCubit,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: const AppView(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
> Don't forget to call `init()` on authentication cubit.
|
|
||||||
|
|
||||||
And in `AppView` use an `AuthenticationBuilder`:
|
> Here we pass some extra inputs for the sign up, and a custom password validator.
|
||||||
|
|
||||||
|
### Cubits
|
||||||
|
|
||||||
|
It is necessary to implement each cubit. Don't panic, most of the work is already done 😊 you just have to customize the logic of these.
|
||||||
|
|
||||||
|
In each of these cubits it is necessary to overload the various callbacks.
|
||||||
|
|
||||||
|
> Here the associated data `Data` is a `int`
|
||||||
|
|
||||||
|
#### Authentication
|
||||||
|
|
||||||
|
In the authentication are managed, the refresh, the deletion of account or the disconnection.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
AuthenticationBuilder(
|
class ExampleAuthenticationCubit extends AuthenticationCubit<int> {
|
||||||
unknown: (context) => const LoadingPage(),
|
ExampleAuthenticationCubit({required super.authenticationRepository});
|
||||||
unauthenticated: (context) => const LoginPage(),
|
|
||||||
authenticated: (context, user, userData) => const HomePage(),
|
@override
|
||||||
)
|
FutureOrResult<int?> onReauthenticate(Result<Account, AppException> result) async {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onRefresh(Result<Account, AppException> result) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInFromCache(SessionWrapper<int> wrapper) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<void> onSignOut() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<void> onDelete() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To create a `SignInCubit` you'll need the same `AuthenticationRepository`, you can use the `context`:
|
#### Sign Up
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
BlocProvider(
|
class ExampleSignUpCubit extends SignUpCubit<int> {
|
||||||
create: (_) => SignInCubit(context.read<AuthenticationRepositoryInterface>()),
|
ExampleSignUpCubit({
|
||||||
child: const LoginForm(),
|
required super.authenticationRepository,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignUpWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) async {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sign In
|
||||||
|
|
||||||
|
```dart
|
||||||
|
class ExampleSignInCubit extends SignInCubit<int> {
|
||||||
|
ExampleSignInCubit({
|
||||||
|
required super.authenticationRepository,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInAnonymously(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInWithGoogle(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
After setting up all these cubits you can provide them in the application. And that's it!
|
||||||
|
|
||||||
|
```dart
|
||||||
|
BlocProvider<SignUpCubit<int>>(
|
||||||
|
create: (_) => ExampleSignUpCubit(
|
||||||
|
authenticationRepository: authenticationRepository,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BlocProvider<SignInCubit<int>>(
|
||||||
|
create: (_) => ExampleSignInCubit(
|
||||||
|
authenticationRepository: authenticationRepository,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
```
|
```
|
||||||
|
|
||||||
> In practice it's better to create it in the main `MultiBlocProvider` because the LoginPage can be destroyed, and cubit closed, before login flow ends
|
### Widgets
|
||||||
|
|
||||||
## Recipes
|
Widgets are provided to make your life easier. Starting with the `AuthenticationBuilder` which allows you to build according to the authentication state.
|
||||||
|
|
||||||
### Password confirmation
|
|
||||||
|
|
||||||
In this recipe we'll se how to create a custom `FormEntry` to confirm password.
|
|
||||||
|
|
||||||
First, create an entry at the SignUpCubit creation:
|
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
SignUpCubit _signUpCubit = SignUpCubit(
|
AuthenticationBuilder<int>(
|
||||||
authenticationRepository: _authenticationRepository,
|
authenticated: (context, sessionWrapper) => Text(
|
||||||
authenticationCubit: _authenticationCubit,
|
'Logged as ${sessionWrapper.session?.account.email} | GeneratedId is ${sessionWrapper.session?.data}'),
|
||||||
entries: const FormData([
|
unauthenticated: (context) =>
|
||||||
FormEntry('form_field_confirmPassword', ConfirmedPassword.pure()),
|
const Text('Not logged (unauthenticated)'),
|
||||||
]),
|
unknown: (context) => const Text('Not logged (unknown)'),
|
||||||
|
),
|
||||||
|
```
|
||||||
|
|
||||||
|
A `BuildContext` extension is also available to access certain attributes more quickly.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
Text('Home | ${context.account<AuthenticationCubit<int>, int>()?.email}'),
|
||||||
|
```
|
||||||
|
|
||||||
|
Listeners are used to listen to the status of the sign in and sign up forms.
|
||||||
|
|
||||||
|
```dart
|
||||||
|
return SignInListener<int>(
|
||||||
|
onError: (context, status, errorMessage) => ScaffoldMessenger.of(context)
|
||||||
|
..hideCurrentSnackBar()
|
||||||
|
..showSnackBar(
|
||||||
|
SnackBar(content: Text(errorMessage ?? 'Sign In Failure')),
|
||||||
|
),
|
||||||
|
child: ...
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, in the sign up form, create an input for password confirmation:
|
|
||||||
|
|
||||||
- `ConfirmedPassword` validator need password value and confirm password value to compare.
|
|
||||||
|
|
||||||
```dart
|
|
||||||
return BlocBuilder<SignUpCubit, SignUpState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return TextField(
|
|
||||||
onChanged: (confirmPassword) => context
|
|
||||||
.read<SignUpCubit>()
|
|
||||||
.dataChanged(
|
|
||||||
'form_field_confirmPassword',
|
|
||||||
ConfirmedPassword.dirty(
|
|
||||||
password: context.read<SignUpCubit>().state.password.value,
|
|
||||||
value: confirmPassword,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
obscureText: true,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'confirm password',
|
|
||||||
errorText: state.data!.input('form_field_confirmPassword').invalid
|
|
||||||
? 'passwords do not match'
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
> `form_field_confirmPassword` is the field identifier used in all application to retrieve data. You can use a constant to avoid typos.
|
|
||||||
|
|
||||||
You'll need to update password input to update confirm state on password update !
|
|
||||||
|
|
||||||
```dart
|
|
||||||
return BlocBuilder<SignUpCubit, SignUpState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return TextField(
|
|
||||||
onChanged: (password) {
|
|
||||||
context.read<SignUpCubit>().passwordChanged(password);
|
|
||||||
context.read<SignUpCubit>().dataChanged(
|
|
||||||
'form_field_confirmPassword',
|
|
||||||
ConfirmedPassword.dirty(
|
|
||||||
password: password,
|
|
||||||
value: context
|
|
||||||
.read<SignUpCubit>()
|
|
||||||
.state
|
|
||||||
.data!
|
|
||||||
.input('form_field_confirmPassword')
|
|
||||||
.value,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
obscureText: true,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'password',
|
|
||||||
errorText: state.password.invalid ? 'invalid password' : null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
> Here you call standard `passwordChanged()` AND `dataChanged()`.
|
|
||||||
|
|
||||||
And voilà !
|
|
||||||
|
|
||||||
### Create Firestore Document on Sign Up
|
|
||||||
|
|
||||||
In this recipe we'll se how to create a Firestore Document on sign up success.
|
|
||||||
|
|
||||||
First create a callback function:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
Future<void> onSignUpSuccess(SignUpState state, String? uid) async {
|
|
||||||
if (uid != null) {
|
|
||||||
final user = {
|
|
||||||
'uid': uid,
|
|
||||||
'email': state.email.value,
|
|
||||||
...state.data.toMap(),
|
|
||||||
};
|
|
||||||
await FirebaseFirestore.instance.collection('users').doc(uid).set(user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Then create SignUpCubit with custom entries and register callback:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
SignUpCubit _signUpCubit = SignUpCubit(
|
|
||||||
authenticationRepository: _authenticationRepository,
|
|
||||||
authenticationCubit: _authenticationCubit,
|
|
||||||
entries: const FormData([
|
|
||||||
FormEntry('form_field_name', Name.pure(), fieldName: 'name'),
|
|
||||||
FormEntry('form_field_phone', Phone.pure(), fieldName: 'phone'),
|
|
||||||
FormEntry('form_field_confirmPassword', ConfirmedPassword.pure(), export: false),
|
|
||||||
]),
|
|
||||||
onSignUpSuccess: onSignUpSuccess,
|
|
||||||
);
|
|
||||||
```
|
|
||||||
|
|
||||||
> Use `fieldName` and `export` to control `.toMap()` result on FormData ! Useful to disable exportation of sensible data like passwords.
|
|
||||||
|
|
||||||
Create widgets for each inputs:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
class _PhoneInput extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BlocBuilder<SignUpCubit, SignUpState>(
|
|
||||||
builder: (context, state) {
|
|
||||||
return TextField(
|
|
||||||
onChanged: (phone) => context
|
|
||||||
.read<SignUpCubit>()
|
|
||||||
.dataChanged('form_field_phone', Phone.dirty(phone)),
|
|
||||||
keyboardType: TextInputType.phone,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: 'phone',
|
|
||||||
helperText: '',
|
|
||||||
errorText: state.data!.input('form_field_phone').invalid
|
|
||||||
? 'invalid phone'
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
> Create widgets for Name and ConfirmedPassword too.
|
|
||||||
|
|
||||||
Then add a sign up button with:
|
|
||||||
|
|
||||||
```dart
|
|
||||||
context.read<SignUpCubit>().signUpFormSubmitted()
|
|
||||||
```
|
|
||||||
|
|
||||||
And voilà, a document with `uid` as id, and fields `email`, `name`, `phone`, `uid` will be create in `users` collection.
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# 404
|
||||||
|
|
||||||
|
Oops, something's gone wrong :-(
|
||||||
|
|
||||||
|
You've tried to visit a page that doesn't exist. Luckily this site has other
|
||||||
|
[pages](index.md).
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
[]
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,214 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# wyatt_authentication_bloc - Dart API docs
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
* Copyright (C) 2023 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/>.
|
||||||
|
-->
|
||||||
|
<h1 id="flutter---authentication-bloc">Flutter - Authentication BLoC</h1><p align="left">
|
||||||
|
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis"></a>
|
||||||
|
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter">
|
||||||
|
</p>
|
||||||
|
<p>Authentication Bloc for Flutter.</p>
|
||||||
|
<h2 id="features">Features</h2>
|
||||||
|
<ul>
|
||||||
|
<li>🧐 Wyatt Architecture</li>
|
||||||
|
<li>🧱 Entities
|
||||||
|
<ul>
|
||||||
|
<li>Account -> Contains account information from provider.</li>
|
||||||
|
<li>Session -> Contains account and associated data retrieved from an external source.</li>
|
||||||
|
<li>AuthenticationChangeEvent -> Describes an event in authentication change (sign in, sign up, sign out, etc...)</li>
|
||||||
|
<li>SessionWrapper -> Contains latest authentication change event and session.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>🔑 Powerful and secured authentication repository</li>
|
||||||
|
<li>🔥 Multiple data sources
|
||||||
|
<ul>
|
||||||
|
<li>Mock</li>
|
||||||
|
<li>Firebase</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>🧊 Cubits, why make it complicated when you can make it simple?
|
||||||
|
<ul>
|
||||||
|
<li>Goes to the essential.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>📐 Consistent
|
||||||
|
<ul>
|
||||||
|
<li>Every class have same naming convention</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>🧪 Tested</li>
|
||||||
|
<li>📚 Documented: <a href="./doc/api/index.md">available here</a></li>
|
||||||
|
</ul>
|
||||||
|
<h2 id="getting-started">Getting started</h2>
|
||||||
|
<p>Simply add <code>wyatt_authentication_bloc</code> in <code>pubspec.yaml</code> , then</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">import 'package:wyatt_authentication_bloc/wyatt_authentication_bloc.dart';
|
||||||
|
</code></pre>
|
||||||
|
<h3 id="data-source">Data source</h3>
|
||||||
|
<p>The first step is to provide a data source.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">getIt.registerLazySingleton<AuthenticationRemoteDataSource<int>>(
|
||||||
|
() => AuthenticationFirebaseDataSourceImpl<int>(
|
||||||
|
firebaseAuth: FirebaseAuth.instance,
|
||||||
|
googleSignIn:
|
||||||
|
GoogleSignIn(clientId: DefaultFirebaseOptions.ios.iosClientId)),
|
||||||
|
);
|
||||||
|
</code></pre>
|
||||||
|
<blockquote>
|
||||||
|
<p>Here we use GetIt (see example project)</p>
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="repository">Repository</h3>
|
||||||
|
<p>Then you can configure your repository.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">final AuthenticationRepository<int> authenticationRepository = AuthenticationRepositoryImpl(
|
||||||
|
authenticationRemoteDataSource:
|
||||||
|
getIt<AuthenticationRemoteDataSource<int>>(),
|
||||||
|
customPasswordValidator: const CustomPassword.pure(),
|
||||||
|
extraSignUpInputs: [
|
||||||
|
FormInput(
|
||||||
|
AuthFormField.confirmPassword,
|
||||||
|
const ConfirmedPassword.pure(),
|
||||||
|
metadata: const FormInputMetadata<void>(export: false),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
</code></pre>
|
||||||
|
<blockquote>
|
||||||
|
<p>Here we pass some extra inputs for the sign up, and a custom password validator.</p>
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="cubits">Cubits</h3>
|
||||||
|
<p>It is necessary to implement each cubit. Don't panic, most of the work is already done 😊 you just have to customize the logic of these.</p>
|
||||||
|
<p>In each of these cubits it is necessary to overload the various callbacks.</p>
|
||||||
|
<blockquote>
|
||||||
|
<p>Here the associated data <code>Data</code> is a <code>int</code></p>
|
||||||
|
</blockquote>
|
||||||
|
<h4 id="authentication">Authentication</h4>
|
||||||
|
<p>In the authentication are managed, the refresh, the deletion of account or the disconnection.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">class ExampleAuthenticationCubit extends AuthenticationCubit<int> {
|
||||||
|
ExampleAuthenticationCubit({required super.authenticationRepository});
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onReauthenticate(Result<Account, AppException> result) async {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onRefresh(Result<Account, AppException> result) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInFromCache(SessionWrapper<int> wrapper) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<void> onSignOut() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<void> onDelete() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
<h4 id="sign-up">Sign Up</h4>
|
||||||
|
<pre class="language-dart"><code class="language-dart">class ExampleSignUpCubit extends SignUpCubit<int> {
|
||||||
|
ExampleSignUpCubit({
|
||||||
|
required super.authenticationRepository,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignUpWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) async {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</code></pre>
|
||||||
|
<h4 id="sign-in">Sign In</h4>
|
||||||
|
<pre class="language-dart"><code class="language-dart">class ExampleSignInCubit extends SignInCubit<int> {
|
||||||
|
ExampleSignInCubit({
|
||||||
|
required super.authenticationRepository,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInWithEmailAndPassword(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInAnonymously(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FutureOrResult<int?> onSignInWithGoogle(Result<Account, AppException> result, WyattForm form) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</code></pre>
|
||||||
|
<p>After setting up all these cubits you can provide them in the application. And that's it!</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">BlocProvider<SignUpCubit<int>>(
|
||||||
|
create: (_) => ExampleSignUpCubit(
|
||||||
|
authenticationRepository: authenticationRepository,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BlocProvider<SignInCubit<int>>(
|
||||||
|
create: (_) => ExampleSignInCubit(
|
||||||
|
authenticationRepository: authenticationRepository,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
</code></pre>
|
||||||
|
<h3 id="widgets">Widgets</h3>
|
||||||
|
<p>Widgets are provided to make your life easier. Starting with the <code>AuthenticationBuilder</code> which allows you to build according to the authentication state.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">AuthenticationBuilder<int>(
|
||||||
|
authenticated: (context, sessionWrapper) => Text(
|
||||||
|
'Logged as ${sessionWrapper.session?.account.email} | GeneratedId is ${sessionWrapper.session?.data}'),
|
||||||
|
unauthenticated: (context) =>
|
||||||
|
const Text('Not logged (unauthenticated)'),
|
||||||
|
unknown: (context) => const Text('Not logged (unknown)'),
|
||||||
|
),
|
||||||
|
</code></pre>
|
||||||
|
<p>A <code>BuildContext</code> extension is also available to access certain attributes more quickly.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">Text('Home | ${context.account<AuthenticationCubit<int>, int>()?.email}'),
|
||||||
|
</code></pre>
|
||||||
|
<p>Listeners are used to listen to the status of the sign in and sign up forms.</p>
|
||||||
|
<pre class="language-dart"><code class="language-dart">return SignInListener<int>(
|
||||||
|
onError: (context, status, errorMessage) => ScaffoldMessenger.of(context)
|
||||||
|
..hideCurrentSnackBar()
|
||||||
|
..showSnackBar(
|
||||||
|
SnackBar(content: Text(errorMessage ?? 'Sign In Failure')),
|
||||||
|
),
|
||||||
|
child: ...
|
||||||
|
);
|
||||||
|
</code></pre>
|
||||||
|
|
||||||
|
|
||||||
|
## Libraries
|
||||||
|
|
||||||
|
##### [wyatt_authentication_bloc](wyatt_authentication_bloc/wyatt_authentication_bloc-library.md)
|
||||||
|
An authentication library for BLoC.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# 404
|
||||||
|
|
||||||
|
Oops, something's gone wrong :-(
|
||||||
|
|
||||||
|
You've tried to visit a page that doesn't exist. Luckily this site has other
|
||||||
|
[pages](index.md).
|
||||||
+237
@@ -0,0 +1,237 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Account class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Represents a user <a href="../wyatt_authentication_bloc/Account-class.md">Account</a> in the
|
||||||
|
various identity provisioning systems.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Inheritance**
|
||||||
|
|
||||||
|
- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)
|
||||||
|
- [Equatable](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable-class.html)
|
||||||
|
- Account
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Implementers**
|
||||||
|
|
||||||
|
- [AccountModel](../wyatt_authentication_bloc/AccountModel-class.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[Account](../wyatt_authentication_bloc/Account/Account.md) ({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isAnonymous, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) emailVerified, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) providerId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? phoneNumber, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? photoURL, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? creationTime, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? lastSignInTime, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isNewUser, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken})
|
||||||
|
|
||||||
|
_const_
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [accessToken](../wyatt_authentication_bloc/Account/accessToken.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user access token
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [creationTime](../wyatt_authentication_bloc/Account/creationTime.md) → [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the users account creation time.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [email](../wyatt_authentication_bloc/Account/email.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The users email address.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [emailVerified](../wyatt_authentication_bloc/Account/emailVerified.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns whether the users email address has been verified.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [hashCode](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [id](../wyatt_authentication_bloc/Account/id.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user's unique ID.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [isAnonymous](../wyatt_authentication_bloc/Account/isAnonymous.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns whether the user is a anonymous.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [isNewUser](../wyatt_authentication_bloc/Account/isNewUser.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Whether the user account has been recently created.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [lastSignInTime](../wyatt_authentication_bloc/Account/lastSignInTime.md) → [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
When the user last signed in as dictated by the server clock.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [phoneNumber](../wyatt_authentication_bloc/Account/phoneNumber.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the users phone number.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [photoURL](../wyatt_authentication_bloc/Account/photoURL.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a photo URL for the user.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [props](../wyatt_authentication_bloc/Account/props.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The list of properties that will be used to determine whether
|
||||||
|
two instances are equal.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [providerId](../wyatt_authentication_bloc/Account/providerId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The provider ID for the user.
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [refreshToken](../wyatt_authentication_bloc/Account/refreshToken.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user refresh token
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [stringify](../wyatt_authentication_bloc/Account/stringify.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If set to <code>true</code>, the <a href="https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/toString.html">toString</a> method will be overridden to output
|
||||||
|
this instance's <a href="../wyatt_authentication_bloc/Account/props.md">props</a>.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Account constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
Account({required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) id, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isAnonymous, required [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) emailVerified, required [String](https://api.flutter.dev/flutter/dart-core/String-class.html) providerId, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? phoneNumber, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? photoURL, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? creationTime, [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? lastSignInTime, [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isNewUser, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
const Account({
|
||||||
|
required this.id,
|
||||||
|
required this.isAnonymous,
|
||||||
|
required this.emailVerified,
|
||||||
|
required this.providerId,
|
||||||
|
this.email,
|
||||||
|
this.phoneNumber,
|
||||||
|
this.photoURL,
|
||||||
|
this.creationTime,
|
||||||
|
this.lastSignInTime,
|
||||||
|
this.isNewUser,
|
||||||
|
this.accessToken,
|
||||||
|
this.refreshToken,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# accessToken property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The user access token</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String? accessToken;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# creationTime property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? creationTime
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Returns the users account creation time.</p>
|
||||||
|
<p>When this account was created as dictated by the server clock.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final DateTime? creationTime;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# email property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? email
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The users email address.</p>
|
||||||
|
<p>Will be <code>null</code> if signing in anonymously.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String? email;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# emailVerified property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) emailVerified
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Returns whether the users email address has been verified.</p>
|
||||||
|
<p>To send a verification email, see <code>SendEmailVerification</code>.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final bool emailVerified;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# id property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) id
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The user's unique ID.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String id;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# isAnonymous property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) isAnonymous
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Returns whether the user is a anonymous.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final bool isAnonymous;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# isNewUser property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)? isNewUser
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Whether the user account has been recently created.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final bool? isNewUser;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# lastSignInTime property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)? lastSignInTime
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>When the user last signed in as dictated by the server clock.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final DateTime? lastSignInTime;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# phoneNumber property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? phoneNumber
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Returns the users phone number.</p>
|
||||||
|
<p>This property will be <code>null</code> if the user has not signed in or been has
|
||||||
|
their phone number linked.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String? phoneNumber;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# photoURL property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? photoURL
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Returns a photo URL for the user.</p>
|
||||||
|
<p>This property will be populated if the user has signed in or been linked
|
||||||
|
with a 3rd party OAuth provider (such as Google).</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String? photoURL;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# props property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Annotations**
|
||||||
|
|
||||||
|
- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html)
|
||||||
|
[List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?> props
|
||||||
|
|
||||||
|
_<span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The list of properties that will be used to determine whether
|
||||||
|
two instances are equal.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [
|
||||||
|
id,
|
||||||
|
isAnonymous,
|
||||||
|
email,
|
||||||
|
emailVerified,
|
||||||
|
phoneNumber,
|
||||||
|
photoURL,
|
||||||
|
creationTime,
|
||||||
|
lastSignInTime,
|
||||||
|
providerId,
|
||||||
|
isNewUser,
|
||||||
|
accessToken,
|
||||||
|
refreshToken,
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# providerId property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) providerId
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The provider ID for the user.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String providerId;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# refreshToken property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The user refresh token</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final String? refreshToken;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# stringify property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Annotations**
|
||||||
|
|
||||||
|
- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html)
|
||||||
|
[bool](https://api.flutter.dev/flutter/dart-core/bool-class.html) stringify
|
||||||
|
|
||||||
|
_<span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>If set to <code>true</code>, the <a href="https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/toString.html">toString</a> method will be overridden to output
|
||||||
|
this instance's <a href="../../wyatt_authentication_bloc/Account/props.md">props</a>.</p>
|
||||||
|
<p>A global default value for <a href="../../wyatt_authentication_bloc/Account/stringify.md">stringify</a> can be set using
|
||||||
|
<code>EquatableConfig.stringify</code>.</p>
|
||||||
|
<p>If this instance's <a href="../../wyatt_authentication_bloc/Account/stringify.md">stringify</a> is set to null, the value of
|
||||||
|
<code>EquatableConfig.stringify</code> will be used instead. This defaults to
|
||||||
|
<code>false</code>.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
@override
|
||||||
|
bool get stringify => true;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+247
@@ -0,0 +1,247 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AccountModel class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Account Model to parse Firebase User data</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Inheritance**
|
||||||
|
|
||||||
|
- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)
|
||||||
|
- [Equatable](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable-class.html)
|
||||||
|
- [Account](../wyatt_authentication_bloc/Account-class.md)
|
||||||
|
- AccountModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[AccountModel.fromFirebaseUser](../wyatt_authentication_bloc/AccountModel/AccountModel.fromFirebaseUser.md) ([User](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/User-class.html)? user, {[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken})
|
||||||
|
|
||||||
|
_factory_
|
||||||
|
|
||||||
|
[AccountModel.fromFirebaseUserCredential](../wyatt_authentication_bloc/AccountModel/AccountModel.fromFirebaseUserCredential.md) ([UserCredential](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/UserCredential-class.html)? userCredential)
|
||||||
|
|
||||||
|
_factory_
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [accessToken](../wyatt_authentication_bloc/Account/accessToken.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user access token
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [creationTime](../wyatt_authentication_bloc/Account/creationTime.md) → [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the users account creation time.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [email](../wyatt_authentication_bloc/Account/email.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The users email address.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [emailVerified](../wyatt_authentication_bloc/Account/emailVerified.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns whether the users email address has been verified.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [hashCode](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [id](../wyatt_authentication_bloc/Account/id.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user's unique ID.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [isAnonymous](../wyatt_authentication_bloc/Account/isAnonymous.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns whether the user is a anonymous.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [isNewUser](../wyatt_authentication_bloc/Account/isNewUser.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Whether the user account has been recently created.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [lastSignInTime](../wyatt_authentication_bloc/Account/lastSignInTime.md) → [DateTime](https://api.flutter.dev/flutter/dart-core/DateTime-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
When the user last signed in as dictated by the server clock.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [phoneNumber](../wyatt_authentication_bloc/Account/phoneNumber.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns the users phone number.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [photoURL](../wyatt_authentication_bloc/Account/photoURL.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Returns a photo URL for the user.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [props](../wyatt_authentication_bloc/Account/props.md) → [List](https://api.flutter.dev/flutter/dart-core/List-class.html)<[Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The list of properties that will be used to determine whether
|
||||||
|
two instances are equal.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [providerId](../wyatt_authentication_bloc/Account/providerId.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The provider ID for the user.
|
||||||
|
_<span class="feature">final</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [refreshToken](../wyatt_authentication_bloc/AccountModel/refreshToken.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The user refresh token
|
||||||
|
_<span class="feature">read-only</span><span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [stringify](../wyatt_authentication_bloc/Account/stringify.md) → [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
If set to <code>true</code>, the <a href="https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/toString.html">toString</a> method will be overridden to output
|
||||||
|
this instance's <a href="../wyatt_authentication_bloc/Account/props.md">props</a>.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [user](../wyatt_authentication_bloc/AccountModel/user.md) → [User](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/User-class.html)?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://pub.dev/documentation/equatable/2.0.5/equatable/Equatable/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AccountModel.fromFirebaseUser constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AccountModel.fromFirebaseUser([User](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/User-class.html)? user, {[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? accessToken})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
factory AccountModel.fromFirebaseUser(User? user, {String? accessToken}) {
|
||||||
|
if (user != null) {
|
||||||
|
final providerId =
|
||||||
|
(user.providerData.isEmpty) ? '' : user.providerData.first.providerId;
|
||||||
|
return AccountModel._(
|
||||||
|
user: user,
|
||||||
|
id: user.uid,
|
||||||
|
emailVerified: user.emailVerified,
|
||||||
|
isAnonymous: user.isAnonymous,
|
||||||
|
providerId: providerId,
|
||||||
|
creationTime: user.metadata.creationTime,
|
||||||
|
lastSignInTime: user.metadata.lastSignInTime,
|
||||||
|
isNewUser: false,
|
||||||
|
email: user.email,
|
||||||
|
phoneNumber: user.phoneNumber,
|
||||||
|
photoURL: user.photoURL,
|
||||||
|
accessToken: accessToken,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw ModelParsingFailureFirebase('null-user', 'User cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AccountModel.fromFirebaseUserCredential constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AccountModel.fromFirebaseUserCredential([UserCredential](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/UserCredential-class.html)? userCredential)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
factory AccountModel.fromFirebaseUserCredential(
|
||||||
|
UserCredential? userCredential,
|
||||||
|
) {
|
||||||
|
final user = userCredential?.user;
|
||||||
|
if (user != null) {
|
||||||
|
final providerId =
|
||||||
|
(user.providerData.isEmpty) ? '' : user.providerData.first.providerId;
|
||||||
|
return AccountModel._(
|
||||||
|
user: user,
|
||||||
|
id: user.uid,
|
||||||
|
emailVerified: user.emailVerified,
|
||||||
|
isAnonymous: user.isAnonymous,
|
||||||
|
providerId: providerId,
|
||||||
|
creationTime: user.metadata.creationTime,
|
||||||
|
lastSignInTime: user.metadata.lastSignInTime,
|
||||||
|
isNewUser: userCredential?.additionalUserInfo?.isNewUser,
|
||||||
|
email: user.email,
|
||||||
|
phoneNumber: user.phoneNumber,
|
||||||
|
photoURL: user.photoURL,
|
||||||
|
accessToken: userCredential?.credential?.accessToken,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw ModelParsingFailureFirebase('null-user', 'User cannot be null');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# refreshToken property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Annotations**
|
||||||
|
|
||||||
|
- @[override](https://api.flutter.dev/flutter/dart-core/override-constant.html)
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? refreshToken
|
||||||
|
|
||||||
|
_<span class="feature">override</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>The user refresh token</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
@override
|
||||||
|
String? get refreshToken => user?.refreshToken;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# user property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[User](https://pub.dev/documentation/firebase_auth/4.2.0/firebase_auth/User-class.html)? user
|
||||||
|
|
||||||
|
_<span class="feature">final</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
final User? user;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+137
@@ -0,0 +1,137 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureFirebase class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Thrown if during the apply action code process if a failure occurs.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Inheritance**
|
||||||
|
|
||||||
|
- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)
|
||||||
|
- [AuthenticationFailureInterface](../wyatt_authentication_bloc/AuthenticationFailureInterface-class.md)
|
||||||
|
- [ApplyActionCodeFailureInterface](../wyatt_authentication_bloc/ApplyActionCodeFailureInterface-class.md)
|
||||||
|
- ApplyActionCodeFailureFirebase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[ApplyActionCodeFailureFirebase](../wyatt_authentication_bloc/ApplyActionCodeFailureFirebase/ApplyActionCodeFailureFirebase.md) ([[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? code, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? msg])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[ApplyActionCodeFailureFirebase.fromCode](../wyatt_authentication_bloc/ApplyActionCodeFailureFirebase/ApplyActionCodeFailureFirebase.fromCode.md) ([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [code](../wyatt_authentication_bloc/AuthenticationFailureInterface/code.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read / write</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [message](../wyatt_authentication_bloc/AuthenticationFailureInterface/message.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [msg](../wyatt_authentication_bloc/AuthenticationFailureInterface/msg.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read / write</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](../wyatt_authentication_bloc/AuthenticationFailureInterface/toString.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureFirebase.fromCode constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ApplyActionCodeFailureFirebase.fromCode([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
ApplyActionCodeFailureFirebase.fromCode(String code) : super.fromCode(code) {
|
||||||
|
switch (code) {
|
||||||
|
case 'expired-action-code':
|
||||||
|
msg = 'Action code has expired.';
|
||||||
|
break;
|
||||||
|
case 'invalid-action-code':
|
||||||
|
msg = 'Action code is invalid.';
|
||||||
|
break;
|
||||||
|
case 'user-disabled':
|
||||||
|
msg = 'This user has been disabled. Please contact support for help.';
|
||||||
|
break;
|
||||||
|
case 'user-not-found':
|
||||||
|
msg = 'Email is not found, please create an account.';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.code = 'unknown';
|
||||||
|
msg = 'An unknown error occurred.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureFirebase constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ApplyActionCodeFailureFirebase([[String](https://api.flutter.dev/flutter/dart-core/String-class.html)? code, [String](https://api.flutter.dev/flutter/dart-core/String-class.html)? msg])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
ApplyActionCodeFailureFirebase([String? code, String? msg])
|
||||||
|
: super(code ?? 'unknown', msg ?? 'An unknown error occurred.');
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+139
@@ -0,0 +1,139 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureInterface class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Thrown if during the apply action code process if a failure occurs.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Inheritance**
|
||||||
|
|
||||||
|
- [Object](https://api.flutter.dev/flutter/dart-core/Object-class.html)
|
||||||
|
- [AuthenticationFailureInterface](../wyatt_authentication_bloc/AuthenticationFailureInterface-class.md)
|
||||||
|
- ApplyActionCodeFailureInterface
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Implementers**
|
||||||
|
|
||||||
|
- [ApplyActionCodeFailureFirebase](../wyatt_authentication_bloc/ApplyActionCodeFailureFirebase-class.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[ApplyActionCodeFailureInterface](../wyatt_authentication_bloc/ApplyActionCodeFailureInterface/ApplyActionCodeFailureInterface.md) ([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg)
|
||||||
|
|
||||||
|
Thrown if during the apply action code process if a failure occurs.
|
||||||
|
|
||||||
|
[ApplyActionCodeFailureInterface.fromCode](../wyatt_authentication_bloc/ApplyActionCodeFailureInterface/ApplyActionCodeFailureInterface.fromCode.md) ([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code)
|
||||||
|
|
||||||
|
Thrown if during the apply action code process if a failure occurs.
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [code](../wyatt_authentication_bloc/AuthenticationFailureInterface/code.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read / write</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [message](../wyatt_authentication_bloc/AuthenticationFailureInterface/message.md) → [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [msg](../wyatt_authentication_bloc/AuthenticationFailureInterface/msg.md) ↔ [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_<span class="feature">read / write</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](../wyatt_authentication_bloc/AuthenticationFailureInterface/toString.md)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureInterface.fromCode constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ApplyActionCodeFailureInterface.fromCode([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code)
|
||||||
|
|
||||||
|
|
||||||
|
<p>Thrown if during the apply action code process if a failure occurs.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
ApplyActionCodeFailureInterface.fromCode(super.code) : super.fromCode();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ApplyActionCodeFailureInterface constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ApplyActionCodeFailureInterface([String](https://api.flutter.dev/flutter/dart-core/String-class.html) code, [String](https://api.flutter.dev/flutter/dart-core/String-class.html) msg)
|
||||||
|
|
||||||
|
|
||||||
|
<p>Thrown if during the apply action code process if a failure occurs.</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
ApplyActionCodeFailureInterface(super.code, super.msg);
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+122
@@ -0,0 +1,122 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AuthFormField class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Default authentication form fields name</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[AuthFormField](../wyatt_authentication_bloc/AuthFormField/AuthFormField.md) ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constants
|
||||||
|
|
||||||
|
##### [confirmPassword](../wyatt_authentication_bloc/AuthFormField/confirmPassword-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Confirm Password field: <code>wyattConfirmPasswordField</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [email](../wyatt_authentication_bloc/AuthFormField/email-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Email field: <code>wyattEmailField</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [password](../wyatt_authentication_bloc/AuthFormField/password-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Password field: <code>wyattPasswordField</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AuthFormField constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AuthFormField()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# confirmPassword constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const confirmPassword
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Confirm Password field: <code>wyattConfirmPasswordField</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
static const confirmPassword = 'wyattConfirmPasswordField';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# email constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const email
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Email field: <code>wyattEmailField</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
static const email = 'wyattEmailField';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# password constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const password
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Password field: <code>wyattPasswordField</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
static const password = 'wyattPasswordField';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AuthFormName class
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Default authentication form name</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constructors
|
||||||
|
|
||||||
|
[AuthFormName](../wyatt_authentication_bloc/AuthFormName/AuthFormName.md) ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
##### [hashCode](https://api.flutter.dev/flutter/dart-core/Object/hashCode.html) → [int](https://api.flutter.dev/flutter/dart-core/int-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The hash code for this object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [runtimeType](https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html) → [Type](https://api.flutter.dev/flutter/dart-core/Type-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A representation of the runtime type of the object.
|
||||||
|
_<span class="feature">read-only</span><span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Methods
|
||||||
|
|
||||||
|
##### [noSuchMethod](https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html)([Invocation](https://api.flutter.dev/flutter/dart-core/Invocation-class.html) invocation) dynamic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Invoked when a non-existent method or property is accessed.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [toString](https://api.flutter.dev/flutter/dart-core/Object/toString.html)() [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
A string representation of this object.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Operators
|
||||||
|
|
||||||
|
##### [operator ==](https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html)([Object](https://api.flutter.dev/flutter/dart-core/Object-class.html) other) [bool](https://api.flutter.dev/flutter/dart-core/bool-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The equality operator.
|
||||||
|
_<span class="feature">inherited</span>_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Constants
|
||||||
|
|
||||||
|
##### [editAccountForm](../wyatt_authentication_bloc/AuthFormName/editAccountForm-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Edit account form: <code>wyattEditAccountForm</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [passwordResetForm](../wyatt_authentication_bloc/AuthFormName/passwordResetForm-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Password reset form: <code>wyattPasswordResetForm</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [signInForm](../wyatt_authentication_bloc/AuthFormName/signInForm-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Sign In form: <code>wyattSignInForm</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### [signUpForm](../wyatt_authentication_bloc/AuthFormName/signUpForm-constant.md) const [String](https://api.flutter.dev/flutter/dart-core/String-class.html)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Sign Up form: <code>wyattSignUpForm</code>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AuthFormName constructor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AuthFormName()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# editAccountForm constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const editAccountForm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Edit account form: <code>wyattEditAccountForm</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
static const String editAccountForm = 'wyattEditAccountForm';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# passwordResetForm constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*[<Null safety>](https://dart.dev/null-safety)*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[String](https://api.flutter.dev/flutter/dart-core/String-class.html) const passwordResetForm
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Password reset form: <code>wyattPasswordResetForm</code></p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```dart
|
||||||
|
static const String passwordResetForm = 'wyattPasswordResetForm';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user