23 lines
767 B
Dart
23 lines
767 B
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:maibu_satabot_v2/features/devices/domain/entities/device_entity.dart';
|
|
|
|
class MyState extends Equatable {
|
|
final bool isLoading; // 是否正在加载
|
|
final String? errorMessage; // 错误信息
|
|
final String? nickName;
|
|
|
|
const MyState({this.isLoading = false, this.errorMessage, this.nickName});
|
|
|
|
// 使用 copyWith 方便局部更新状态
|
|
MyState copyWith({bool? isLoading, String? errorMessage, String? nickName}) {
|
|
return MyState(
|
|
isLoading: isLoading ?? this.isLoading,
|
|
errorMessage: errorMessage, // 错误信息通常每次更新都要重新赋值或清空
|
|
nickName: nickName,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [isLoading, errorMessage, nickName];
|
|
}
|