part of 'volumes_bloc.dart'; sealed class VolumesState extends Equatable { const VolumesState({ required this.diskStatus, required final serverVolumesHashCode, this.providerVolumes = const [], }) : _serverVolumesHashCode = serverVolumesHashCode; final DiskStatus diskStatus; final List providerVolumes; List get volumes => diskStatus.diskVolumes; final int? _serverVolumesHashCode; DiskVolume getVolume(final String volumeName) => volumes.firstWhere( (final volume) => volume.name == volumeName, orElse: () => DiskVolume(), ); bool get isProviderVolumesLoaded => providerVolumes.isNotEmpty; VolumesState copyWith({ required final int? serverVolumesHashCode, final DiskStatus? diskStatus, final List? providerVolumes, }); } class VolumesInitial extends VolumesState { VolumesInitial() : super( diskStatus: DiskStatus(), serverVolumesHashCode: null, ); @override List get props => [providerVolumes, _serverVolumesHashCode]; @override VolumesInitial copyWith({ required final int? serverVolumesHashCode, final DiskStatus? diskStatus, final List? providerVolumes, }) => VolumesInitial(); } class VolumesLoading extends VolumesState { VolumesLoading({ super.serverVolumesHashCode, final DiskStatus? diskStatus, final List? providerVolumes, }) : super( diskStatus: diskStatus ?? DiskStatus(), providerVolumes: providerVolumes ?? const [], ); @override List get props => [providerVolumes, _serverVolumesHashCode]; @override VolumesLoading copyWith({ required final int? serverVolumesHashCode, final DiskStatus? diskStatus, final List? providerVolumes, }) => VolumesLoading( diskStatus: diskStatus ?? this.diskStatus, providerVolumes: providerVolumes ?? this.providerVolumes, serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!, ); } class VolumesLoaded extends VolumesState { const VolumesLoaded({ required super.serverVolumesHashCode, required super.diskStatus, final List? providerVolumes, }) : super( providerVolumes: providerVolumes ?? const [], ); @override List get props => [providerVolumes, _serverVolumesHashCode]; @override VolumesLoaded copyWith({ final DiskStatus? diskStatus, final List? providerVolumes, final int? serverVolumesHashCode, }) => VolumesLoaded( diskStatus: diskStatus ?? this.diskStatus, providerVolumes: providerVolumes ?? this.providerVolumes, serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!, ); } class VolumesResizing extends VolumesState { const VolumesResizing({ required super.serverVolumesHashCode, required super.diskStatus, final List? providerVolumes, }) : super( providerVolumes: providerVolumes ?? const [], ); @override List get props => [providerVolumes, _serverVolumesHashCode]; @override VolumesResizing copyWith({ final DiskStatus? diskStatus, final List? providerVolumes, final int? serverVolumesHashCode, }) => VolumesResizing( diskStatus: diskStatus ?? this.diskStatus, providerVolumes: providerVolumes ?? this.providerVolumes, serverVolumesHashCode: serverVolumesHashCode ?? _serverVolumesHashCode!, ); }