-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_document_state.dart
59 lines (44 loc) · 1.35 KB
/
create_document_state.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'dart:io' show File;
import 'package:flutter/foundation.dart';
import 'create_document_cubit.dart';
/// State for [CreateDocumentCubit].
@immutable
sealed class CreateDocumentState {
const CreateDocumentState();
CreateDocumentLoadingState toLoading() {
return const CreateDocumentLoadingState();
}
CreateDocumentSuccessState toSuccess(File file, String documentId) {
return CreateDocumentSuccessState(file, documentId);
}
CreateDocumentErrorState toError(Object error) {
return CreateDocumentErrorState(error);
}
@override
String toString() {
return "$runtimeType()";
}
}
class CreateDocumentInitialState extends CreateDocumentState {
const CreateDocumentInitialState();
}
class CreateDocumentLoadingState extends CreateDocumentState {
const CreateDocumentLoadingState();
}
class CreateDocumentErrorState extends CreateDocumentState {
final Object error;
const CreateDocumentErrorState(this.error);
@override
String toString() {
return "$runtimeType(error: $error)";
}
}
class CreateDocumentSuccessState extends CreateDocumentState {
final File file;
final String documentId;
const CreateDocumentSuccessState(this.file, this.documentId);
@override
String toString() {
return "$runtimeType(file: $file, documentId: $documentId)";
}
}