Skip to content

Instantly share code, notes, and snippets.

@arulwastaken
Last active April 1, 2021 06:13
Show Gist options
  • Save arulwastaken/b005961bd958f61d02131a333899a4f0 to your computer and use it in GitHub Desktop.
Save arulwastaken/b005961bd958f61d02131a333899a4f0 to your computer and use it in GitHub Desktop.
LocationState
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