Hugo Pointcheval 3a7b7dfd1d
Some checks failed
continuous-integration/drone/pr Build is failing
feat(crud): add streaming usecase (closes #180)
2023-11-14 14:04:57 +01:00

58 lines
1.8 KiB
Dart

// 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 'package:crud_bloc_example/user_entity.dart';
import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
/// A [CrudAdvancedCubit] for [User].
class UserAdvancedCubit extends CrudAdvancedCubit<User> {
final CrudRepository<User> crudRepository;
UserAdvancedCubit(this.crudRepository);
@override
ModelIdentifier<User> get modelIdentifier => ModelIdentifier(
getIdentifier: (user) => user.id ?? '',
);
@override
Create<User>? get crudCreate => Create(crudRepository);
@override
Delete<User>? get crudDelete => Delete(crudRepository);
@override
DeleteAll<User>? get crudDeleteAll => DeleteAll(crudRepository);
@override
Get<User>? get crudGet => Get(crudRepository);
@override
GetAll<User>? get crudGetAll => GetAll(crudRepository);
@override
Search<User>? get crudSearch => Search(crudRepository);
@override
Streaming<User>? get crudStreaming => Streaming(crudRepository);
@override
Update<User>? get crudUpdate => Update(crudRepository);
@override
UpdateAll<User>? get crudUpdateAll => UpdateAll(crudRepository);
}