40 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:wyatt_bloc_helper/src/mixins/repository_base_provider_mixin.dart';
import 'package:wyatt_bloc_helper/src/repository/repository_provider_screen.dart';
/// {@template repository_provider}
/// Need to implement a [create] function that is responsible for
/// creating the [Repository] and a [builder] which will return a child
/// that have access to the instance via `context.read<Repository>()`.
/// It is used as a dependency injection (DI) widget so that a single instance
/// of a [Repository] can be provided to multiple widgets within a subtree.
///
/// It automatically handles closing the instance when used with [create].
/// By default, [create] is called only when the instance is accessed.
/// To override this behavior, set [lazy] to `false`.
///
/// By default, it provide already provided instance found in the tree.
/// To override this behavior, set [smart] to `false`.
/// {@endtemplate}
abstract class RepositoryProviderScreen<Repository>
extends RepositoryBaseProviderScreen<Repository>
with RepositoryProviderMixin {
/// {@macro repository_provider}
const RepositoryProviderScreen({super.key});
}