diff --git a/lib/utils/request_status.dart b/lib/utils/request_status.dart new file mode 100644 index 0000000..dd37f69 --- /dev/null +++ b/lib/utils/request_status.dart @@ -0,0 +1,42 @@ +class RequestStatus { + final String name; + + const RequestStatus._internal(this.name); + + static const RequestStatus IDLE = const RequestStatus._internal("IDLE"); + static const RequestStatus WAITING = const RequestStatus._internal("WAITING"); + static const RequestStatus DONE = const RequestStatus._internal("DONE"); + static const RequestStatus ERROR = const RequestStatus._internal("ERROR"); + + @override + String toString() => name; +} + +class RequestObject { + T result; + dynamic error; + RequestStatus status; + dynamic tag; //A dynamic value to identify this RequestObject + + RequestObject(this.result, this.status); + + RequestObject.done({this.result, this.tag}) { + this.status = RequestStatus.DONE; + } + + RequestObject.error({this.error, this.tag}) { + this.status = RequestStatus.ERROR; + } + + RequestObject.waiting({this.result, this.tag}) { + this.status = RequestStatus.WAITING; + } + + RequestObject.idle({this.result, this.tag}) { + this.status = RequestStatus.IDLE; + } + + @override + String toString() => + "RequestObject {$status} ${result != null ? "{$result}" : ""}"; +} diff --git a/pubspec.lock b/pubspec.lock index 220a641..857b881 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,20 +1,34 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.4.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" charcode: dependency: transitive description: @@ -29,6 +43,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" flutter: dependency: "direct main" description: flutter @@ -39,48 +67,62 @@ packages: description: flutter source: sdk version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.6" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.1.8" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" + version: "1.6.4" pedantic: dependency: transitive description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" quiver: dependency: "direct main" description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.5" rxdart: dependency: "direct main" description: name: rxdart url: "https://pub.dartlang.org" source: hosted - version: "0.22.0" + version: "0.22.6" sky_engine: dependency: transitive description: flutter @@ -113,7 +155,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.0.5" term_glyph: dependency: transitive description: @@ -127,7 +169,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.11" typed_data: dependency: transitive description: @@ -142,5 +184,12 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.4.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 4c42c39..78f67c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shinayser_essentials_flutter description: A new Flutter project. -version: 1.15.0 +version: 1.16.0 author: homepage: @@ -12,7 +12,7 @@ dependencies: sdk: flutter quiver: '>=2.0.0 <3.0.0' - rxdart: ^0.22.0 + rxdart: ^0.22.6 dev_dependencies: flutter_test: