PMU_PIbd32_Kamcharova_K.A/lib/bloc/state.dart

33 lines
914 B
Dart
Raw Normal View History

import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
2024-12-21 20:38:35 +04:00
import '../domain/models/character.dart';
import 'package:identity/data/dtos/character_dto.dart';
enum HomeStatus { initial, loading, loaded, error }
class HomeState extends Equatable {
final HomeStatus status;
2024-12-21 20:38:35 +04:00
final List<Character> characters; // Используйте Character, а не CharacterDTO
final String errorMessage;
const HomeState({
this.status = HomeStatus.initial,
this.characters = const [],
this.errorMessage = '',
});
HomeState copyWith({
HomeStatus? status,
2024-12-21 20:38:35 +04:00
List<Character>? characters,
String? errorMessage,
}) {
return HomeState(
status: status ?? this.status,
characters: characters ?? this.characters,
errorMessage: errorMessage ?? this.errorMessage,
);
}
@override
List<Object?> get props => [status, characters, errorMessage];
}