diff --git a/packages/wyatt_architecture/example/lib/bootstrap.dart b/packages/wyatt_architecture/example/lib/bootstrap.dart
index 253a38a1..f7bd381c 100644
--- a/packages/wyatt_architecture/example/lib/bootstrap.dart
+++ b/packages/wyatt_architecture/example/lib/bootstrap.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/core/constants/hive_boxes.dart b/packages/wyatt_architecture/example/lib/core/constants/hive_boxes.dart
index a7b56de8..867f4301 100644
--- a/packages/wyatt_architecture/example/lib/core/constants/hive_boxes.dart
+++ b/packages/wyatt_architecture/example/lib/core/constants/hive_boxes.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/core/dependency_injection/get_it.dart b/packages/wyatt_architecture/example/lib/core/dependency_injection/get_it.dart
index a3e2bc25..eee59863 100644
--- a/packages/wyatt_architecture/example/lib/core/dependency_injection/get_it.dart
+++ b/packages/wyatt_architecture/example/lib/core/dependency_injection/get_it.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -17,14 +17,14 @@
import 'dart:async';
import 'package:architecture_example/data/data_sources/local/favorite_hive_data_source.dart';
+import 'package:architecture_example/data/data_sources/local/favorite_local_data_source.dart';
import 'package:architecture_example/data/data_sources/local/favorite_mock_data_source.dart';
import 'package:architecture_example/data/data_sources/remote/album_api_data_source_impl.dart';
import 'package:architecture_example/data/data_sources/remote/album_mock_data_source_impl.dart';
+import 'package:architecture_example/data/data_sources/remote/album_remote_data_source.dart';
import 'package:architecture_example/data/data_sources/remote/photo_api_data_source_impl.dart';
import 'package:architecture_example/data/data_sources/remote/photo_mock_data_source_impl.dart';
-import 'package:architecture_example/domain/data_sources/local/favorite_local_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/album_remote_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/photo_remote_data_source.dart';
+import 'package:architecture_example/data/data_sources/remote/photo_remote_data_source.dart';
import 'package:get_it/get_it.dart';
import 'package:wyatt_http_client/wyatt_http_client.dart';
diff --git a/packages/wyatt_architecture/example/lib/core/enums/fetch_status.dart b/packages/wyatt_architecture/example/lib/core/enums/fetch_status.dart
index ba225d05..a9d897af 100644
--- a/packages/wyatt_architecture/example/lib/core/enums/fetch_status.dart
+++ b/packages/wyatt_architecture/example/lib/core/enums/fetch_status.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/core/utils/app_bloc_observer.dart b/packages/wyatt_architecture/example/lib/core/utils/app_bloc_observer.dart
index 3574badd..d3de471f 100644
--- a/packages/wyatt_architecture/example/lib/core/utils/app_bloc_observer.dart
+++ b/packages/wyatt_architecture/example/lib/core/utils/app_bloc_observer.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_hive_data_source.dart b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_hive_data_source.dart
index bf862fc5..cf9aabdc 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_hive_data_source.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_hive_data_source.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,11 +15,11 @@
// along with this program. If not, see .
import 'package:architecture_example/core/constants/hive_boxes.dart';
-import 'package:architecture_example/domain/data_sources/local/favorite_local_data_source.dart';
+import 'package:architecture_example/data/data_sources/local/favorite_local_data_source.dart';
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:hive/hive.dart';
-class FavoriteHiveDataSource extends FavoriteLocalDataSource {
+class FavoriteHiveDataSource implements FavoriteLocalDataSource {
@override
Future addPhotoToFavorites(Photo photo) async {
final box = await Hive.openBox(HiveBoxes.favorites);
diff --git a/packages/wyatt_architecture/example/lib/domain/data_sources/local/favorite_local_data_source.dart b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_local_data_source.dart
similarity index 90%
rename from packages/wyatt_architecture/example/lib/domain/data_sources/local/favorite_local_data_source.dart
rename to packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_local_data_source.dart
index 587a99ee..f0cd1684 100644
--- a/packages/wyatt_architecture/example/lib/domain/data_sources/local/favorite_local_data_source.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_local_data_source.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-abstract class FavoriteLocalDataSource extends BaseLocalDataSource {
+abstract interface class FavoriteLocalDataSource extends BaseLocalDataSource {
Future addPhotoToFavorites(Photo photo);
Future deletePhotoFromFavorites(int id);
Future> getAllPhotosFromFavorites();
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_mock_data_source.dart b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_mock_data_source.dart
index 48972654..6b6e2b87 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_mock_data_source.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/local/favorite_mock_data_source.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+import 'package:architecture_example/data/data_sources/local/favorite_local_data_source.dart';
import 'package:architecture_example/data/models/photo_model.dart';
-import 'package:architecture_example/domain/data_sources/local/favorite_local_data_source.dart';
import 'package:architecture_example/domain/entities/photo.dart';
-class FavoriteMockDataSource extends FavoriteLocalDataSource {
+class FavoriteMockDataSource implements FavoriteLocalDataSource {
final Map _mock = {
2: const PhotoModel(
albumId: 1,
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_api_data_source_impl.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_api_data_source_impl.dart
index 3c4cdcdf..3fe4868c 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_api_data_source_impl.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_api_data_source_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,14 +16,13 @@
import 'dart:convert';
+import 'package:architecture_example/data/data_sources/remote/album_remote_data_source.dart';
import 'package:architecture_example/data/models/album_model.dart';
import 'package:architecture_example/data/models/list_album_model.dart';
-import 'package:architecture_example/domain/data_sources/remote/album_remote_data_source.dart';
import 'package:architecture_example/domain/entities/album.dart';
import 'package:wyatt_http_client/wyatt_http_client.dart';
-import 'package:wyatt_type_utils/wyatt_type_utils.dart';
-class AlbumApiDataSourceImpl extends AlbumRemoteDataSource {
+class AlbumApiDataSourceImpl implements AlbumRemoteDataSource {
AlbumApiDataSourceImpl(this._client);
final MiddlewareClient _client;
@@ -37,8 +36,8 @@ class AlbumApiDataSourceImpl extends AlbumRemoteDataSource {
@override
Future> getAllAlbums({int? start, int? limit}) async {
- final startQuery = start.isNotNull ? '_start=$start' : '';
- final limitQuery = limit.isNotNull ? '_limit=$limit' : '';
+ final startQuery = (start != null) ? '_start=$start' : '';
+ final limitQuery = (limit != null) ? '_limit=$limit' : '';
final delimiter1 =
(startQuery.isNotEmpty || limitQuery.isNotEmpty) ? '?' : '';
final delimiter2 =
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart
index d63875cb..34cce6ff 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,12 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+import 'package:architecture_example/data/data_sources/remote/album_remote_data_source.dart';
import 'package:architecture_example/data/models/album_model.dart';
-import 'package:architecture_example/domain/data_sources/remote/album_remote_data_source.dart';
import 'package:architecture_example/domain/entities/album.dart';
-import 'package:wyatt_type_utils/wyatt_type_utils.dart';
-class AlbumMockDataSourceImpl extends AlbumRemoteDataSource {
+class AlbumMockDataSourceImpl implements AlbumRemoteDataSource {
final Map _mock = {
1: const AlbumModel(
id: 1,
@@ -31,10 +30,10 @@ class AlbumMockDataSourceImpl extends AlbumRemoteDataSource {
@override
Future getAlbum(int id) async {
final response = _mock[id];
- if (response.isNull) {
+ if (response == null) {
throw Exception('Unknown album');
}
- return response!;
+ return response;
}
@override
diff --git a/packages/wyatt_architecture/example/lib/domain/data_sources/remote/album_remote_data_source.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_remote_data_source.dart
similarity index 89%
rename from packages/wyatt_architecture/example/lib/domain/data_sources/remote/album_remote_data_source.dart
rename to packages/wyatt_architecture/example/lib/data/data_sources/remote/album_remote_data_source.dart
index fbef7f9a..e0468759 100644
--- a/packages/wyatt_architecture/example/lib/domain/data_sources/remote/album_remote_data_source.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_remote_data_source.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/album.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-abstract class AlbumRemoteDataSource extends BaseRemoteDataSource {
+abstract interface class AlbumRemoteDataSource extends BaseRemoteDataSource {
Future getAlbum(int id);
Future> getAllAlbums({int? start, int? limit});
}
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_api_data_source_impl.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_api_data_source_impl.dart
index 3f559fe8..79a24784 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_api_data_source_impl.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_api_data_source_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,14 +16,13 @@
import 'dart:convert';
+import 'package:architecture_example/data/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/data/models/list_photo_model.dart';
import 'package:architecture_example/data/models/photo_model.dart';
-import 'package:architecture_example/domain/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:wyatt_http_client/wyatt_http_client.dart';
-import 'package:wyatt_type_utils/wyatt_type_utils.dart';
-class PhotoApiDataSourceImpl extends PhotoRemoteDataSource {
+class PhotoApiDataSourceImpl implements PhotoRemoteDataSource {
PhotoApiDataSourceImpl(this._client);
final MiddlewareClient _client;
@@ -37,8 +36,8 @@ class PhotoApiDataSourceImpl extends PhotoRemoteDataSource {
@override
Future> getAllPhotos({int? start, int? limit}) async {
- final startQuery = start.isNotNull ? '_start=$start' : '';
- final limitQuery = limit.isNotNull ? '_limit=$limit' : '';
+ final startQuery = (start != null) ? '_start=$start' : '';
+ final limitQuery = (limit != null) ? '_limit=$limit' : '';
final delimiter1 =
(startQuery.isNotEmpty || limitQuery.isNotEmpty) ? '?' : '';
final delimiter2 =
@@ -56,8 +55,8 @@ class PhotoApiDataSourceImpl extends PhotoRemoteDataSource {
int? start,
int? limit,
}) async {
- final startQuery = start.isNotNull ? '_start=$start' : '';
- final limitQuery = limit.isNotNull ? '_limit=$limit' : '';
+ final startQuery = (start != null) ? '_start=$start' : '';
+ final limitQuery = (limit != null) ? '_limit=$limit' : '';
final delimiter =
(startQuery.isNotEmpty && limitQuery.isNotEmpty) ? '&' : '';
final url = '/photos?albumId=$albumId&$startQuery$delimiter$limitQuery';
diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_mock_data_source_impl.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_mock_data_source_impl.dart
index 219ca635..2068f3ff 100644
--- a/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_mock_data_source_impl.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_mock_data_source_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,12 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+import 'package:architecture_example/data/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/data/models/photo_model.dart';
-import 'package:architecture_example/domain/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/domain/entities/photo.dart';
-import 'package:wyatt_type_utils/wyatt_type_utils.dart';
-class PhotoMockDataSourceImpl extends PhotoRemoteDataSource {
+class PhotoMockDataSourceImpl implements PhotoRemoteDataSource {
final Map _mock = {
1: const PhotoModel(
albumId: 1,
@@ -40,10 +39,10 @@ class PhotoMockDataSourceImpl extends PhotoRemoteDataSource {
@override
Future getPhoto(int id) async {
final response = _mock[id];
- if (response.isNull) {
+ if (response == null) {
throw Exception('Unknown photo');
}
- return response!;
+ return response;
}
@override
diff --git a/packages/wyatt_architecture/example/lib/domain/data_sources/remote/photo_remote_data_source.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_remote_data_source.dart
similarity index 90%
rename from packages/wyatt_architecture/example/lib/domain/data_sources/remote/photo_remote_data_source.dart
rename to packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_remote_data_source.dart
index 81d03a9a..35e9ab5f 100644
--- a/packages/wyatt_architecture/example/lib/domain/data_sources/remote/photo_remote_data_source.dart
+++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/photo_remote_data_source.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-abstract class PhotoRemoteDataSource extends BaseRemoteDataSource {
+abstract interface class PhotoRemoteDataSource extends BaseRemoteDataSource {
Future getPhoto(int id);
Future> getAllPhotos({int? start, int? limit});
Future> getPhotosFromAlbum(int albumId, {int? start, int? limit});
diff --git a/packages/wyatt_architecture/example/lib/data/models/album_model.dart b/packages/wyatt_architecture/example/lib/data/models/album_model.dart
index 21317878..25661ac7 100644
--- a/packages/wyatt_architecture/example/lib/data/models/album_model.dart
+++ b/packages/wyatt_architecture/example/lib/data/models/album_model.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/data/models/list_album_model.dart b/packages/wyatt_architecture/example/lib/data/models/list_album_model.dart
index 7537cb0e..603f8802 100644
--- a/packages/wyatt_architecture/example/lib/data/models/list_album_model.dart
+++ b/packages/wyatt_architecture/example/lib/data/models/list_album_model.dart
@@ -1,5 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/data/models/list_photo_model.dart b/packages/wyatt_architecture/example/lib/data/models/list_photo_model.dart
index 38350986..465ef36b 100644
--- a/packages/wyatt_architecture/example/lib/data/models/list_photo_model.dart
+++ b/packages/wyatt_architecture/example/lib/data/models/list_photo_model.dart
@@ -1,5 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/data/models/photo_model.dart b/packages/wyatt_architecture/example/lib/data/models/photo_model.dart
index 47128564..f5aa79b9 100644
--- a/packages/wyatt_architecture/example/lib/data/models/photo_model.dart
+++ b/packages/wyatt_architecture/example/lib/data/models/photo_model.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/data/repositories/photo_repository_impl.dart b/packages/wyatt_architecture/example/lib/data/repositories/photo_repository_impl.dart
index 274502f1..e0d5388e 100644
--- a/packages/wyatt_architecture/example/lib/data/repositories/photo_repository_impl.dart
+++ b/packages/wyatt_architecture/example/lib/data/repositories/photo_repository_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,14 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'package:architecture_example/domain/data_sources/local/favorite_local_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/album_remote_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/photo_remote_data_source.dart';
+import 'package:architecture_example/data/data_sources/local/favorite_local_data_source.dart';
+import 'package:architecture_example/data/data_sources/remote/album_remote_data_source.dart';
+import 'package:architecture_example/data/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/domain/entities/album.dart';
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
+import 'package:sealed_result/sealed_result.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class PhotoRepositoryImpl extends PhotoRepository {
PhotoRepositoryImpl(
@@ -34,43 +34,35 @@ class PhotoRepositoryImpl extends PhotoRepository {
final FavoriteLocalDataSource _favoriteLocalDataSource;
@override
- FutureOrResult addPhotoToFavorites(Photo photo) => Result.tryCatchAsync(
+ FutureOrResult addPhotoToFavorites(Photo photo) => Result.fromAsync(
() => _favoriteLocalDataSource.addPhotoToFavorites(photo),
- (error) => const ClientException('Cannot add photo to favorites.'),
);
@override
- FutureOrResult checkIfPhotoIsInFavorites(int id) =>
- Result.tryCatchAsync(
+ FutureOrResult checkIfPhotoIsInFavorites(int id) => Result.fromAsync(
() => _favoriteLocalDataSource.checkIfPhotoIsInFavorites(id),
- (error) =>
- ClientException('Cannot check if photo `$id` is in favorites.'),
);
@override
- FutureOrResult deletePhotoFromFavorites(int id) => Result.tryCatchAsync(
+ FutureOrResult deletePhotoFromFavorites(int id) => Result.fromAsync(
() => _favoriteLocalDataSource.deletePhotoFromFavorites(id),
- (error) => ClientException('Cannot delete photo `$id` from favorites.'),
);
@override
- FutureOrResult getAlbum(int id) => Result.tryCatchAsync(
+ FutureOrResult getAlbum(int id) => Result.fromAsync(
() => _albumRemoteDataSource.getAlbum(id),
- (error) => ServerException('Cannot retrieve album $id.'),
);
@override
FutureOrResult> getAllAlbums({int? start, int? limit}) =>
- Result.tryCatchAsync(
+ Result.fromAsync(
() => _albumRemoteDataSource.getAllAlbums(start: start, limit: limit),
- (error) => const ServerException('Cannot retrieve all albums.'),
);
@override
FutureOrResult> getAllPhotos({int? start, int? limit}) async =>
- Result.tryCatchAsync(
+ Result.fromAsync(
() => _photoRemoteDataSource.getAllPhotos(start: start, limit: limit),
- (error) => const ServerException('Cannot retrieve all photos.'),
);
@override
@@ -89,15 +81,14 @@ class PhotoRepositoryImpl extends PhotoRepository {
return Ok(response);
} catch (_) {
return const Err(
- ClientException('Cannot retrieve all photos from favorites.'),
+ ClientException(message: 'Cannot retrieve all photos from favorites.'),
);
}
}
@override
- FutureOrResult getPhoto(int id) => Result.tryCatchAsync(
+ FutureOrResult getPhoto(int id) => Result.fromAsync(
() => _photoRemoteDataSource.getPhoto(id),
- (error) => ServerException('Cannot retrieve photo $id.'),
);
@override
@@ -106,13 +97,11 @@ class PhotoRepositoryImpl extends PhotoRepository {
int? start,
int? limit,
}) async =>
- Result.tryCatchAsync(
+ Result.fromAsync(
() => _photoRemoteDataSource.getPhotosFromAlbum(
albumId,
start: start,
limit: limit,
),
- (error) =>
- ServerException('Cannot retrieve all photos from album $albumId'),
);
}
diff --git a/packages/wyatt_architecture/example/lib/domain/entities/album.dart b/packages/wyatt_architecture/example/lib/domain/entities/album.dart
index 10824187..a8e6da89 100644
--- a/packages/wyatt_architecture/example/lib/domain/entities/album.dart
+++ b/packages/wyatt_architecture/example/lib/domain/entities/album.dart
@@ -1,5 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/domain/entities/photo.dart b/packages/wyatt_architecture/example/lib/domain/entities/photo.dart
index 43ca6d10..4df1770a 100644
--- a/packages/wyatt_architecture/example/lib/domain/entities/photo.dart
+++ b/packages/wyatt_architecture/example/lib/domain/entities/photo.dart
@@ -1,5 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/params/query_parameters.dart b/packages/wyatt_architecture/example/lib/domain/entities/query_parameters.dart
similarity index 74%
rename from packages/wyatt_architecture/example/lib/domain/usecases/photos/params/query_parameters.dart
rename to packages/wyatt_architecture/example/lib/domain/entities/query_parameters.dart
index 4ac96e8e..f55c3341 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/params/query_parameters.dart
+++ b/packages/wyatt_architecture/example/lib/domain/entities/query_parameters.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,8 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-class QueryParameters {
- QueryParameters(this.start, this.limit, {this.albumId = -1});
+import 'package:flutter/foundation.dart';
+import 'package:wyatt_architecture/wyatt_architecture.dart';
+
+@immutable
+class QueryParameters extends Entity {
+ const QueryParameters(this.start, this.limit, {this.albumId = -1});
+
final int albumId;
final int? start;
final int? limit;
diff --git a/packages/wyatt_architecture/example/lib/domain/repositories/photo_repository.dart b/packages/wyatt_architecture/example/lib/domain/repositories/photo_repository.dart
index 7bc195ea..2108f88b 100644
--- a/packages/wyatt_architecture/example/lib/domain/repositories/photo_repository.dart
+++ b/packages/wyatt_architecture/example/lib/domain/repositories/photo_repository.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/add_photo_to_favorites.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/add_photo_to_favorites.dart
index ef8a0ec9..cb1bf1db 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/add_photo_to_favorites.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/add_photo_to_favorites.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,14 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class AddPhotoToFavorites extends AsyncUseCase> {
- AddPhotoToFavorites(this._photoRepository);
+class AddPhotoToFavorites extends Usecase> {
+ const AddPhotoToFavorites(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
@@ -29,11 +28,4 @@ class AddPhotoToFavorites extends AsyncUseCase> {
await _photoRepository.addPhotoToFavorites(params!);
return _photoRepository.getAllPhotosFromFavorites();
}
-
- @override
- FutureOr onStart(Photo? params) {
- if (params == null) {
- throw const ClientException('Photo cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/check_if_photo_is_in_favorites.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/check_if_photo_is_in_favorites.dart
index f0dcfa5c..dfb8a471 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/check_if_photo_is_in_favorites.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/check_if_photo_is_in_favorites.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,23 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class CheckIfPhotoIsInFavorites extends AsyncUseCase {
- CheckIfPhotoIsInFavorites(this._photoRepository);
+class CheckIfPhotoIsInFavorites extends Usecase {
+ const CheckIfPhotoIsInFavorites(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
FutureOrResult execute(int? params) async =>
_photoRepository.checkIfPhotoIsInFavorites(params!);
-
- @override
- FutureOr onStart(int? params) {
- if (params == null) {
- throw const ClientException('id cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_favorites.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_favorites.dart
index 8bdf027f..94865fc1 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_favorites.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_favorites.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -18,12 +18,13 @@ import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class DisplayFavorites extends AsyncUseCase> {
- DisplayFavorites(this._photoRepository);
+class DisplayFavorites extends NoParamsUsecase> {
+ const DisplayFavorites(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
- FutureOrResult> execute(void params) {
+ FutureOrResult> execute() {
final photos = _photoRepository.getAllPhotosFromFavorites();
return photos;
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_photo.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_photo.dart
index 79a06b8a..da8d44a7 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_photo.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/display_photo.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,14 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class DisplayPhoto extends AsyncUseCase {
- DisplayPhoto(this._photoRepository);
+class DisplayPhoto extends Usecase {
+ const DisplayPhoto(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
@@ -29,11 +28,4 @@ class DisplayPhoto extends AsyncUseCase {
final photo = _photoRepository.getPhoto(params!);
return photo;
}
-
- @override
- FutureOr onStart(int? params) {
- if (params == null) {
- throw const ClientException('id cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/open_album.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/open_album.dart
index 358e86a2..bd8df95d 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/open_album.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/open_album.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,15 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/entities/photo.dart';
+import 'package:architecture_example/domain/entities/query_parameters.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class OpenAlbum extends AsyncUseCase> {
- OpenAlbum(this._photoRepository);
+class OpenAlbum extends Usecase> {
+ const OpenAlbum(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
@@ -35,11 +34,4 @@ class OpenAlbum extends AsyncUseCase> {
return photos;
}
-
- @override
- FutureOr onStart(QueryParameters? params) {
- if (params == null) {
- throw const ClientException('params cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/remove_photo_from_favorites.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/remove_photo_from_favorites.dart
index e73206b3..2a929744 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/remove_photo_from_favorites.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/remove_photo_from_favorites.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,14 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class RemovePhotoFromFavorites extends AsyncUseCase> {
- RemovePhotoFromFavorites(this._photoRepository);
+class RemovePhotoFromFavorites extends Usecase> {
+ const RemovePhotoFromFavorites(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
@@ -29,11 +28,4 @@ class RemovePhotoFromFavorites extends AsyncUseCase> {
await _photoRepository.deletePhotoFromFavorites(params!);
return _photoRepository.getAllPhotosFromFavorites();
}
-
- @override
- FutureOr onStart(int? params) {
- if (params == null) {
- throw const ClientException('id cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/domain/usecases/photos/retrieve_all_albums.dart b/packages/wyatt_architecture/example/lib/domain/usecases/photos/retrieve_all_albums.dart
index e88f8a12..8c7a8fe4 100644
--- a/packages/wyatt_architecture/example/lib/domain/usecases/photos/retrieve_all_albums.dart
+++ b/packages/wyatt_architecture/example/lib/domain/usecases/photos/retrieve_all_albums.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,15 +14,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'dart:async';
-
import 'package:architecture_example/domain/entities/album.dart';
+import 'package:architecture_example/domain/entities/query_parameters.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart';
-class RetrieveAllAlbums extends AsyncUseCase> {
- RetrieveAllAlbums(this._photoRepository);
+class RetrieveAllAlbums extends Usecase> {
+ const RetrieveAllAlbums(this._photoRepository);
+
final PhotoRepository _photoRepository;
@override
@@ -33,11 +32,4 @@ class RetrieveAllAlbums extends AsyncUseCase> {
);
return albums;
}
-
- @override
- FutureOr onStart(QueryParameters? params) {
- if (params == null) {
- throw const ClientException('params cannot be null');
- }
- }
}
diff --git a/packages/wyatt_architecture/example/lib/main.dart b/packages/wyatt_architecture/example/lib/main.dart
index d69dbdc5..e8c44b6f 100644
--- a/packages/wyatt_architecture/example/lib/main.dart
+++ b/packages/wyatt_architecture/example/lib/main.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/albums.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/albums.dart
deleted file mode 100644
index eef53465..00000000
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/albums.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2022 WYATT GROUP
-// Please see the AUTHORS file for details.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-
-import 'package:architecture_example/presentation/features/albums/state_management/albums_screen.dart';
-import 'package:flutter/material.dart';
-
-class Albums extends StatelessWidget {
- const Albums({super.key});
-
- @override
- Widget build(BuildContext context) => const AlbumsScreen();
-}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_bloc.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_bloc.dart
index 896a06dd..e02f49ef 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_bloc.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_bloc.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,8 @@
import 'package:architecture_example/core/enums/fetch_status.dart';
import 'package:architecture_example/domain/entities/album.dart';
-import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
+import 'package:architecture_example/domain/entities/query_parameters.dart';
+import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/retrieve_all_albums.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:equatable/equatable.dart';
@@ -39,6 +40,11 @@ class AlbumBloc extends Bloc {
transformer: throttleDroppable(throttleDuration),
);
}
+
+ factory AlbumBloc.create(PhotoRepository photoRepository) => AlbumBloc(
+ RetrieveAllAlbums(photoRepository),
+ );
+
final RetrieveAllAlbums _retrieveAllAlbums;
Future _onAlbumFetched(
@@ -50,7 +56,7 @@ class AlbumBloc extends Bloc {
}
if (state.status == FetchStatus.initial) {
final albums =
- await _retrieveAllAlbums.call(QueryParameters(0, _albumLimit));
+ await _retrieveAllAlbums.call(const QueryParameters(0, _albumLimit));
return emit(
albums.fold(
(value) => state.copyWith(
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_event.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_event.dart
index e202eb1b..d9e0aad7 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_event.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_event.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_state.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_state.dart
index 3d8f688e..d764aa8e 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_state.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/blocs/album/album_state.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_screen.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/screens/albums_screen.dart
similarity index 74%
rename from packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_screen.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/albums/screens/albums_screen.dart
index b180827e..cc666227 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_screen.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/screens/albums_screen.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,11 +15,8 @@
// along with this program. If not, see .
import 'package:architecture_example/core/enums/fetch_status.dart';
-import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/retrieve_all_albums.dart';
import 'package:architecture_example/presentation/features/albums/blocs/album/album_bloc.dart';
-import 'package:architecture_example/presentation/features/albums/state_management/albums_wrapper_widget.dart';
-import 'package:architecture_example/presentation/features/albums/state_management/widgets/albums_list.dart';
+import 'package:architecture_example/presentation/features/albums/stateful/albums_list.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
@@ -27,18 +24,12 @@ class AlbumsScreen extends BlocScreen {
const AlbumsScreen({super.key});
@override
- AlbumBloc create(BuildContext context) =>
- AlbumBloc(RetrieveAllAlbums(repo(context)));
+ AlbumBloc create(BuildContext context) => AlbumBloc.create(repo(context));
@override
AlbumBloc init(BuildContext context, AlbumBloc bloc) =>
bloc..add(AlbumFetched());
- @override
- Widget parent(BuildContext context, Widget child) => AlbumsWrapperWidget(
- child: child,
- );
-
@override
Widget onBuild(BuildContext context, AlbumState state) {
switch (state.status) {
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/stateful/albums_list.dart
similarity index 86%
rename from packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/albums/stateful/albums_list.dart
index 5e2db9f6..bf5a6dc6 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/stateful/albums_list.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,8 +16,9 @@
import 'package:architecture_example/domain/entities/album.dart';
import 'package:architecture_example/presentation/features/albums/blocs/album/album_bloc.dart';
-import 'package:architecture_example/presentation/features/albums/state_management/widgets/albums_list_item.dart';
+import 'package:architecture_example/presentation/features/albums/stateless/albums_list_item.dart';
import 'package:architecture_example/presentation/shared/widgets/bottom_loader.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -33,6 +34,14 @@ class AlbumsList extends StatefulWidget {
@override
State createState() => _AlbumsListState();
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties
+ ..add(IterableProperty('albums', albums))
+ ..add(DiagnosticsProperty('hasReachedMax', hasReachedMax));
+ }
}
class _AlbumsListState extends State {
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list_item.dart b/packages/wyatt_architecture/example/lib/presentation/features/albums/stateless/albums_list_item.dart
similarity index 74%
rename from packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list_item.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/albums/stateless/albums_list_item.dart
index c53f6fee..a2893f54 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/widgets/albums_list_item.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/albums/stateless/albums_list_item.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,7 +15,8 @@
// along with this program. If not, see .
import 'package:architecture_example/domain/entities/album.dart';
-import 'package:architecture_example/presentation/features/photos/photos.dart';
+import 'package:architecture_example/presentation/pages/photos_page.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class AlbumsListItem extends StatelessWidget {
@@ -30,8 +31,14 @@ class AlbumsListItem extends StatelessWidget {
dense: true,
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => Photos(albumId: album.id),
+ builder: (context) => PhotosPage(albumId: album.id),
),
),
);
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(DiagnosticsProperty('album', album));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/app/app.dart b/packages/wyatt_architecture/example/lib/presentation/features/app/app.dart
index 31034d67..3a4e0c04 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/app/app.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/app/app.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,12 +15,12 @@
// along with this program. If not, see .
import 'package:architecture_example/core/dependency_injection/get_it.dart';
+import 'package:architecture_example/data/data_sources/local/favorite_local_data_source.dart';
+import 'package:architecture_example/data/data_sources/remote/album_remote_data_source.dart';
+import 'package:architecture_example/data/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/data/repositories/photo_repository_impl.dart';
-import 'package:architecture_example/domain/data_sources/local/favorite_local_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/album_remote_data_source.dart';
-import 'package:architecture_example/domain/data_sources/remote/photo_remote_data_source.dart';
import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/presentation/features/albums/albums.dart';
+import 'package:architecture_example/presentation/pages/albums_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -41,7 +41,7 @@ class App extends StatelessWidget {
child: const MaterialApp(
title: 'Demo',
debugShowCheckedModeBanner: false,
- home: Albums(),
+ home: AlbumsPage(),
),
);
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_cubit.dart b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_cubit.dart
index c009776d..00b69a71 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_cubit.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_cubit.dart
@@ -1,5 +1,5 @@
// ignore_for_file: public_member_api_docs, sort_constructors_first
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -18,6 +18,7 @@
import 'dart:async';
import 'package:architecture_example/domain/entities/photo.dart';
+import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/add_photo_to_favorites.dart';
import 'package:architecture_example/domain/usecases/photos/check_if_photo_is_in_favorites.dart';
import 'package:architecture_example/domain/usecases/photos/display_photo.dart';
@@ -28,11 +29,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
part 'photo_details_state.dart';
class PhotoDetailsCubit extends Cubit {
- final DisplayPhoto _displayPhoto;
- final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
- final AddPhotoToFavorites _addPhotoToFavorites;
- final RemovePhotoFromFavorites _removePhotoFromFavorites;
-
PhotoDetailsCubit(
this._displayPhoto,
this._checkIfPhotoIsInFavorites,
@@ -40,6 +36,21 @@ class PhotoDetailsCubit extends Cubit {
this._removePhotoFromFavorites,
) : super(PhotoDetailsInitial());
+ factory PhotoDetailsCubit.create(
+ PhotoRepository photoRepository,
+ ) =>
+ PhotoDetailsCubit(
+ DisplayPhoto(photoRepository),
+ CheckIfPhotoIsInFavorites(photoRepository),
+ AddPhotoToFavorites(photoRepository),
+ RemovePhotoFromFavorites(photoRepository),
+ );
+
+ final DisplayPhoto _displayPhoto;
+ final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
+ final AddPhotoToFavorites _addPhotoToFavorites;
+ final RemovePhotoFromFavorites _removePhotoFromFavorites;
+
FutureOr load(int photoId) async {
final photo = await _displayPhoto.call(photoId);
final isFavorite = await _checkIfPhotoIsInFavorites.call(photoId);
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_state.dart b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_state.dart
index 980678c0..6bbe8d62 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_state.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/blocs/photo_details/photo_details_state.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_screen.dart b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/screens/photo_details_screen.dart
similarity index 76%
rename from packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_screen.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/photo_details/screens/photo_details_screen.dart
index 98a41c54..0584763e 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_screen.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/screens/photo_details_screen.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -14,13 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/add_photo_to_favorites.dart';
-import 'package:architecture_example/domain/usecases/photos/check_if_photo_is_in_favorites.dart';
-import 'package:architecture_example/domain/usecases/photos/display_photo.dart';
-import 'package:architecture_example/domain/usecases/photos/remove_photo_from_favorites.dart';
import 'package:architecture_example/presentation/features/photo_details/blocs/photo_details/photo_details_cubit.dart';
-import 'package:architecture_example/presentation/features/photo_details/state_management/photo_details_wrapper_widget.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
@@ -31,21 +26,13 @@ class PhotoDetailsScreen
final int photoId;
@override
- PhotoDetailsCubit create(BuildContext context) => PhotoDetailsCubit(
- DisplayPhoto(repo(context)),
- CheckIfPhotoIsInFavorites(repo(context)),
- AddPhotoToFavorites(repo(context)),
- RemovePhotoFromFavorites(repo(context)),
- );
+ PhotoDetailsCubit create(BuildContext context) =>
+ PhotoDetailsCubit.create(repo(context));
@override
PhotoDetailsCubit init(BuildContext context, PhotoDetailsCubit bloc) =>
bloc..load(photoId);
- @override
- Widget parent(BuildContext context, Widget child) =>
- PhotoDetailsWrapperWidget(child: child);
-
@override
Widget onBuild(BuildContext context, PhotoDetailsState state) {
if (state is PhotoDetailsFailure) {
@@ -116,4 +103,10 @@ class PhotoDetailsScreen
child: CircularProgressIndicator(),
);
}
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(IntProperty('photoId', photoId));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_wrapper_widget.dart b/packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_wrapper_widget.dart
deleted file mode 100644
index 7a7fa919..00000000
--- a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/state_management/photo_details_wrapper_widget.dart
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2022 WYATT GROUP
-// Please see the AUTHORS file for details.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-
-import 'package:flutter/material.dart';
-
-class PhotoDetailsWrapperWidget extends StatelessWidget {
- const PhotoDetailsWrapperWidget({required this.child, super.key});
-
- final Widget child;
-
- @override
- Widget build(BuildContext context) => Scaffold(
- body: child,
- );
-}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/favorite_checker/favorite_checker_cubit.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/favorite_checker/favorite_checker_cubit.dart
index 7999f3a4..5e12d94d 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/favorite_checker/favorite_checker_cubit.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/favorite_checker/favorite_checker_cubit.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,6 +16,7 @@
import 'dart:async';
+import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/check_if_photo_is_in_favorites.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -25,6 +26,14 @@ part 'favorite_checker_state.dart';
class FavoriteCheckerCubit extends Cubit {
FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites)
: super(FavoriteCheckerInitial());
+
+ factory FavoriteCheckerCubit.create(
+ PhotoRepository photoRepository,
+ ) =>
+ FavoriteCheckerCubit(
+ CheckIfPhotoIsInFavorites(photoRepository),
+ );
+
final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
FutureOr checkIfPhotoIsInFavorites(int photoId) async {
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_bloc.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_bloc.dart
index a0893eca..3455cfd7 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_bloc.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_bloc.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,8 +16,9 @@
import 'package:architecture_example/core/enums/fetch_status.dart';
import 'package:architecture_example/domain/entities/photo.dart';
+import 'package:architecture_example/domain/entities/query_parameters.dart';
+import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:architecture_example/domain/usecases/photos/open_album.dart';
-import 'package:architecture_example/domain/usecases/photos/params/query_parameters.dart';
import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -39,6 +40,11 @@ class PhotoBloc extends Bloc {
transformer: throttleDroppable(throttleDuration),
);
}
+
+ factory PhotoBloc.create(PhotoRepository photoRepository) => PhotoBloc(
+ OpenAlbum(photoRepository),
+ );
+
final OpenAlbum _openAlbum;
Future _onPhotoFetched(
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_event.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_event.dart
index 7f52aa44..961e4ae3 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_event.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_event.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_state.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_state.dart
index 094f5b71..78031c32 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_state.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/blocs/photo/photo_state.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/photos.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/photos.dart
deleted file mode 100644
index c32c538a..00000000
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/photos.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2022 WYATT GROUP
-// Please see the AUTHORS file for details.
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
-
-import 'package:architecture_example/presentation/features/photos/state_management/photos_screen.dart';
-import 'package:flutter/material.dart';
-
-class Photos extends StatelessWidget {
- const Photos({required this.albumId, super.key});
-
- final int albumId;
-
- @override
- Widget build(BuildContext context) => PhotosScreen(albumId: albumId);
-}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_grid_thumbnail.dart
similarity index 79%
rename from packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_grid_thumbnail.dart
index c11b52c0..f5376e5d 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_grid_thumbnail.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,10 +15,9 @@
// along with this program. If not, see .
import 'package:architecture_example/domain/entities/photo.dart';
-import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/check_if_photo_is_in_favorites.dart';
-import 'package:architecture_example/presentation/features/photo_details/photo_details.dart';
import 'package:architecture_example/presentation/features/photos/blocs/favorite_checker/favorite_checker_cubit.dart';
+import 'package:architecture_example/presentation/pages/photo_details_page.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
@@ -29,9 +28,8 @@ class PhotosGridThumbnail
final Photo photo;
@override
- FavoriteCheckerCubit create(BuildContext context) => FavoriteCheckerCubit(
- CheckIfPhotoIsInFavorites(repo(context)),
- );
+ FavoriteCheckerCubit create(BuildContext context) =>
+ FavoriteCheckerCubit.create(repo(context));
@override
FavoriteCheckerCubit init(BuildContext context, FavoriteCheckerCubit bloc) =>
@@ -42,7 +40,7 @@ class PhotosGridThumbnail
GestureDetector(
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => PhotoDetails(photoId: photo.id),
+ builder: (context) => PhotoDetailsPage(photoId: photo.id),
),
),
child: Stack(
@@ -63,4 +61,10 @@ class PhotosGridThumbnail
],
),
);
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(DiagnosticsProperty('photo', photo));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_screen.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_screen.dart
similarity index 76%
rename from packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_screen.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_screen.dart
index bf9352dd..0571ccc8 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_screen.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/screens/photos_screen.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -15,11 +15,9 @@
// along with this program. If not, see .
import 'package:architecture_example/core/enums/fetch_status.dart';
-import 'package:architecture_example/domain/repositories/photo_repository.dart';
-import 'package:architecture_example/domain/usecases/photos/open_album.dart';
import 'package:architecture_example/presentation/features/photos/blocs/photo/photo_bloc.dart';
-import 'package:architecture_example/presentation/features/photos/state_management/photos_wrapper_widget.dart';
-import 'package:architecture_example/presentation/features/photos/state_management/widgets/photos_grid.dart';
+import 'package:architecture_example/presentation/features/photos/stateful/photos_grid.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
@@ -29,18 +27,12 @@ class PhotosScreen extends BlocScreen {
final int albumId;
@override
- PhotoBloc create(BuildContext context) =>
- PhotoBloc(OpenAlbum(repo(context)));
+ PhotoBloc create(BuildContext context) => PhotoBloc.create(repo(context));
@override
PhotoBloc init(BuildContext context, PhotoBloc bloc) =>
bloc..add(PhotoFetched(albumId));
- @override
- Widget parent(BuildContext context, Widget child) => PhotosWrapperWidget(
- child: child,
- );
-
@override
Widget onBuild(BuildContext context, PhotoState state) {
switch (state.status) {
@@ -58,4 +50,10 @@ class PhotosScreen extends BlocScreen {
);
}
}
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(IntProperty('albumId', albumId));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/stateful/photos_grid.dart
similarity index 86%
rename from packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid.dart
rename to packages/wyatt_architecture/example/lib/presentation/features/photos/stateful/photos_grid.dart
index 8f1d125a..a6e06ecb 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/stateful/photos_grid.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
@@ -16,8 +16,9 @@
import 'package:architecture_example/domain/entities/photo.dart';
import 'package:architecture_example/presentation/features/photos/blocs/photo/photo_bloc.dart';
-import 'package:architecture_example/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart';
+import 'package:architecture_example/presentation/features/photos/screens/photos_grid_thumbnail.dart';
import 'package:architecture_example/presentation/shared/widgets/bottom_loader.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -35,6 +36,15 @@ class PhotosGrid extends StatefulWidget {
@override
State createState() => _PhotosGridState();
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties
+ ..add(IterableProperty('photos', photos))
+ ..add(IntProperty('albumId', albumId))
+ ..add(DiagnosticsProperty('hasReachedMax', hasReachedMax));
+ }
}
class _PhotosGridState extends State {
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_wrapper_widget.dart b/packages/wyatt_architecture/example/lib/presentation/pages/albums_page.dart
similarity index 78%
rename from packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_wrapper_widget.dart
rename to packages/wyatt_architecture/example/lib/presentation/pages/albums_page.dart
index ea602b88..306c0573 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/albums/state_management/albums_wrapper_widget.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/pages/albums_page.dart
@@ -1,4 +1,4 @@
-// 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
@@ -14,18 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+import 'package:architecture_example/presentation/features/albums/screens/albums_screen.dart';
import 'package:flutter/material.dart';
-class AlbumsWrapperWidget extends StatelessWidget {
- const AlbumsWrapperWidget({required this.child, super.key});
-
- final Widget child;
+class AlbumsPage extends StatelessWidget {
+ const AlbumsPage({super.key});
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Albums'),
),
- body: child,
+ body: const AlbumsScreen(),
);
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/photo_details.dart b/packages/wyatt_architecture/example/lib/presentation/pages/photo_details_page.dart
similarity index 60%
rename from packages/wyatt_architecture/example/lib/presentation/features/photo_details/photo_details.dart
rename to packages/wyatt_architecture/example/lib/presentation/pages/photo_details_page.dart
index 31b83557..accbc800 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photo_details/photo_details.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/pages/photo_details_page.dart
@@ -1,4 +1,4 @@
-// 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
@@ -14,14 +14,23 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-import 'package:architecture_example/presentation/features/photo_details/state_management/photo_details_screen.dart';
+import 'package:architecture_example/presentation/features/photo_details/screens/photo_details_screen.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
-class PhotoDetails extends StatelessWidget {
- const PhotoDetails({required this.photoId, super.key});
+class PhotoDetailsPage extends StatelessWidget {
+ const PhotoDetailsPage({required this.photoId, super.key});
final int photoId;
@override
- Widget build(BuildContext context) => PhotoDetailsScreen(photoId: photoId);
+ Widget build(BuildContext context) => Scaffold(
+ body: PhotoDetailsScreen(photoId: photoId),
+ );
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(IntProperty('photoId', photoId));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_wrapper_widget.dart b/packages/wyatt_architecture/example/lib/presentation/pages/photos_page.dart
similarity index 62%
rename from packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_wrapper_widget.dart
rename to packages/wyatt_architecture/example/lib/presentation/pages/photos_page.dart
index 92db0355..77cec62d 100644
--- a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/photos_wrapper_widget.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/pages/photos_page.dart
@@ -1,4 +1,4 @@
-// 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
@@ -14,18 +14,26 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+import 'package:architecture_example/presentation/features/photos/screens/photos_screen.dart';
+import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
-class PhotosWrapperWidget extends StatelessWidget {
- const PhotosWrapperWidget({required this.child, super.key});
+class PhotosPage extends StatelessWidget {
+ const PhotosPage({required this.albumId, super.key});
- final Widget child;
+ final int albumId;
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Photos'),
),
- body: child,
+ body: PhotosScreen(albumId: albumId),
);
+
+ @override
+ void debugFillProperties(DiagnosticPropertiesBuilder properties) {
+ super.debugFillProperties(properties);
+ properties.add(IntProperty('albumId', albumId));
+ }
}
diff --git a/packages/wyatt_architecture/example/lib/presentation/shared/widgets/bottom_loader.dart b/packages/wyatt_architecture/example/lib/presentation/shared/widgets/bottom_loader.dart
index 844ef1e3..8a86d0bc 100644
--- a/packages/wyatt_architecture/example/lib/presentation/shared/widgets/bottom_loader.dart
+++ b/packages/wyatt_architecture/example/lib/presentation/shared/widgets/bottom_loader.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/example/pubspec.yaml b/packages/wyatt_architecture/example/pubspec.yaml
index c964317c..766fbb84 100644
--- a/packages/wyatt_architecture/example/pubspec.yaml
+++ b/packages/wyatt_architecture/example/pubspec.yaml
@@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
- sdk: ">=2.17.0 <3.0.0"
+ sdk: ^3.0.0
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@@ -41,6 +41,7 @@ dependencies:
bloc_concurrency: ^0.2.0
freezed_annotation: ^2.2.0
json_annotation: ^4.7.0
+ sealed_result: ^3.0.0
wyatt_bloc_helper:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
@@ -48,9 +49,6 @@ dependencies:
wyatt_http_client:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/
version: ^2.0.1
- wyatt_type_utils:
- hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
- version: ^0.0.5
dev_dependencies:
build_runner: ^2.3.2
diff --git a/packages/wyatt_architecture/example/test/widget_test.dart b/packages/wyatt_architecture/example/test/widget_test.dart
index 1bb8b149..aab2c9a4 100644
--- a/packages/wyatt_architecture/example/test/widget_test.dart
+++ b/packages/wyatt_architecture/example/test/widget_test.dart
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 WYATT GROUP
+// Copyright (C) WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
diff --git a/packages/wyatt_architecture/pubspec.yaml b/packages/wyatt_architecture/pubspec.yaml
index e3379349..85863467 100644
--- a/packages/wyatt_architecture/pubspec.yaml
+++ b/packages/wyatt_architecture/pubspec.yaml
@@ -22,14 +22,13 @@ version: 0.2.0+1
publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
environment:
- sdk: ">=2.17.0 <3.0.0"
+ sdk: ^3.0.0
dependencies:
- wyatt_type_utils:
- hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
- version: ^0.0.5
+ sealed_result: ^3.0.0
+ generic_usecase: ^3.0.0
dev_dependencies:
wyatt_analysis:
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
- version: ^2.5.0
+ version: ^2.6.0