33 lines
914 B
Dart
33 lines
914 B
Dart
import 'package:equatable/equatable.dart';
|
||
import 'package:flutter/material.dart';
|
||
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;
|
||
final List<Character> characters; // Используйте Character, а не CharacterDTO
|
||
final String errorMessage;
|
||
|
||
const HomeState({
|
||
this.status = HomeStatus.initial,
|
||
this.characters = const [],
|
||
this.errorMessage = '',
|
||
});
|
||
|
||
HomeState copyWith({
|
||
HomeStatus? status,
|
||
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];
|
||
}
|