| Crates.io | dioxus-sdk-geolocation |
| lib.rs | dioxus-sdk-geolocation |
| version | 0.7.0 |
| created_at | 2025-11-06 21:44:19.000982+00 |
| updated_at | 2025-11-06 21:44:19.000982+00 |
| description | Geolocation utilities and hooks for Dioxus. |
| homepage | https://dioxuslabs.com |
| repository | https://github.com/DioxusLabs/sdk/ |
| max_upload_size | |
| id | 1920762 |
| size | 74,264 |
Geolocation utilities and hooks for Dioxus.
Add dioxus-sdk-geolocation to your Cargo.toml:
[dependencies]
dioxus-sdk-geolocation = "0.1"
Example:
use dioxus::prelude::*;
use dioxus_sdk_geolocation::{
init_geolocator, use_geolocation, PowerMode
};
#[component]
fn App() -> Element {
let geolocator = init_geolocator(PowerMode::High).unwrap();
let coords = use_geolocation();
match coords {
Ok(coords) => {
rsx!( p { "Latitude: {coords.latitude} | Longitude: {coords.longitude}" } )
}
Err(Error::NotInitialized) => {
rsx!( p { "Initializing..." } )
}
Err(e) => {
rsx!( p { "An error occurred {e}" } )
}
}
}