Last active
April 1, 2021 06:13
-
-
Save arulwastaken/b005961bd958f61d02131a333899a4f0 to your computer and use it in GitHub Desktop.
LocationState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocationState { | |
LocationEnum state; | |
String? message; | |
LocationData? location; | |
LocationState({required this.state, this.message, this.location}); | |
static LocationState loading({String? message}) { | |
return LocationState(state: LocationEnum.LOADING, message: message); | |
} | |
static LocationState error({String? message}) { | |
return LocationState(state: LocationEnum.ERROR, message: message); | |
} | |
@override | |
String toString() { | |
return "State: ${state.toString()}, Message ${message != null ? message : "-"}, Location ${location?.latitude}"; | |
} | |
} | |
enum LocationEnum { | |
LOADING, | |
ERROR, | |
REQUESTING_LOCATION_SERVICE, | |
REQUESTING_LOCATION_PERMISSION, | |
REQUESTING_LOCATION, | |
LOCATION_FOUND, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment