h3_core 1.0.1 copy "h3_core: ^1.0.1" to clipboard
h3_core: ^1.0.1 copied to clipboard

Dart/Flutter bindings for the H3 geospatial indexing library. Uses dart:ffi on native platforms, h3-js on web.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:h3_core/h3_core.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late String _cellHex;
  late LatLng _center;
  late int _resolution;

  @override
  void initState() {
    super.initState();
    final sf = LatLng(37.7749295, -122.4194155);
    final cell = latLngToCell(sf, 9);
    _cellHex = cell.toHex();
    _center = cellToLatLng(cell);
    _resolution = getResolution(cell);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('H3 Core Demo')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text('H3 v${H3Version.native}'),
              const SizedBox(height: 16),
              Text('Cell: $_cellHex'),
              Text('Resolution: $_resolution'),
              Text(
                'Center: ${_center.lat.toStringAsFixed(6)}, ${_center.lng.toStringAsFixed(6)}',
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
217
downloads

Publisher

verified publisherwayq.in

Weekly Downloads

Dart/Flutter bindings for the H3 geospatial indexing library. Uses dart:ffi on native platforms, h3-js on web.

Repository (GitHub)
View/report issues

Topics

#h3 #geospatial #hexagonal #indexing #geo

License

unknown (license)

Dependencies

code_assets, ffi, glob, hooks, logging, native_toolchain_c

More

Packages that depend on h3_core