PMU_PIbd32_Kamcharova_K.A/lib/bloc/state.dart

33 lines
914 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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];
}