milestone/stable-1-reconcile-auth-3 #176
@ -1,5 +1,5 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * Copyright (C) 2022 WYATT GROUP
 | 
			
		||||
 * Copyright (C) 2023 WYATT GROUP
 | 
			
		||||
 * Please see the AUTHORS file for details.
 | 
			
		||||
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
@ -7,7 +7,7 @@
 | 
			
		||||
 * 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,
 | 
			
		||||
 * 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.
 | 
			
		||||
@ -19,11 +19,7 @@
 | 
			
		||||
# Flutter - Wyatt Architecture
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
  <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>
 | 
			
		||||
 | 
			
		||||
@ -31,10 +27,10 @@ The Wyatt Architecture for Flutter.
 | 
			
		||||
 | 
			
		||||
## Features
 | 
			
		||||
 | 
			
		||||
- Usecase
 | 
			
		||||
- Repository
 | 
			
		||||
- DataSource
 | 
			
		||||
- Entity
 | 
			
		||||
* Usecase
 | 
			
		||||
* Repository
 | 
			
		||||
* DataSource
 | 
			
		||||
* Entity
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
@ -79,7 +75,7 @@ And finaly create your different usecases :
 | 
			
		||||
 | 
			
		||||
Several use cases are supported :
 | 
			
		||||
 | 
			
		||||
- Classic usecase :
 | 
			
		||||
* Classic usecase :
 | 
			
		||||
 | 
			
		||||
```dart
 | 
			
		||||
class Test extends AsyncUseCase<QueryParameters, List<Photo>>> {
 | 
			
		||||
@ -109,7 +105,6 @@ class SearchPhotos extends AsyncUseCase<QueryParameters, List<Photo>>> {
 | 
			
		||||
    return photos;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  FutureOr<void> onStart(QueryParameters? params) {
 | 
			
		||||
    if(params.start == null || params.limit == null){
 | 
			
		||||
@ -120,9 +115,9 @@ class SearchPhotos extends AsyncUseCase<QueryParameters, List<Photo>>> {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You can implement error scenarios overriding `onError`, or check postconditions by overriding `onComplete` .
 | 
			
		||||
You can implement error scenarios overriding `onError` , or check postconditions by overriding `onComplete` .
 | 
			
		||||
 | 
			
		||||
- Stream usecase :
 | 
			
		||||
* Stream usecase :
 | 
			
		||||
 | 
			
		||||
```dart
 | 
			
		||||
class SearchPhotos extends StreamUseCase<QueryParameters, List<Photo>>> {
 | 
			
		||||
@ -139,9 +134,9 @@ class SearchPhotos extends StreamUseCase<QueryParameters, List<Photo>>> {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
On this case, observers allow you to add alternative scénarios when data changed, overriding `onData` or `onDone`.
 | 
			
		||||
On this case, observers allow you to add alternative scenarios when data changed, overriding `onData` or `onDone` .
 | 
			
		||||
 | 
			
		||||
Please note that to use handlers, call `call` method and not `execute`.
 | 
			
		||||
Please note that to use handlers, call `call` method and not `execute` .
 | 
			
		||||
 | 
			
		||||
> In fact, here we need a new parameter object, so let's create it:
 | 
			
		||||
 | 
			
		||||
@ -156,7 +151,7 @@ class QueryParameters {
 | 
			
		||||
 | 
			
		||||
### Data
 | 
			
		||||
 | 
			
		||||
We start by creating models for photos and list of photos. You can use `freezed`. The `PhotoModel` extends `Photo` with some de/serializer capabilities. And those are used only in data layer.
 | 
			
		||||
We start by creating models for photos and list of photos. You can use `freezed` . The `PhotoModel` extends `Photo` with some de/serializer capabilities. And those are used only in data layer.
 | 
			
		||||
 | 
			
		||||
Then implements your data sources:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user