browser library

Web / Flutter web entry: install the packed .bin, then use the same API as package:timezone_finder/timezone_finder.dart.

Web only — like package:timezone/browser.dart. Do not import both; this library re-exports the main API. Conditionally import it on the same branch that loads the .bin. VM / CLI / server / Flutter mobile and desktop use timezone_finder.dart (boundaries are embedded).

Before findLocation: latest_all tzdata and this .bin. Prefer installBoundaries when you already have bytes. initializeBoundaries fetches boundariesDefaultUrl (<base href> and asset hosting matter).

import 'package:timezone/browser.dart' as tz;
import 'package:timezone_finder/browser.dart';

Future<void> main() async {
  await tz.initializeTimeZone('packages/timezone/data/latest_all.tzf');
  await initializeBoundaries();
  findLocation(2.3522, 48.8566)?.name; // 'Europe/Paris'
}

Flutter web: declare boundariesDefaultUrl under flutter: assets: in your pubspec, then installBoundaries from rootBundle. Self-host with initializeBoundaries('https://cdn.example.com/$boundariesBinName').

Extensions

GeoJsonLocation on String
Resolves a geocoder's GeoJSON answer to a Location.
LocationZoneNames on Location
English display name for a Location.
TZDateTimeAcrossLocations on TZDateTime
Relates this instant to another place: its wall clock, and its offset.
TZDateTimeZoneNames on TZDateTime
English labels for a TZDateTime at its instant.

Constants

boundariesBinName → const String
Packed index filename under package:timezone_finder/data/.
boundariesDefaultUrl → const String
Default URL for initializeBoundaries in browsers.
cldrVersion → const String
CLDR release used for English time-zone long names.

Properties

boundaryDataVersion String
Timezone-boundary-builder release for these borders (e.g. '2026c'). Independent of the tzdb version behind package:timezone. Reading this decodes the index; on web that requires installBoundaries first.
no setter

Functions

ensurePreloaded() Future<void>
Decode the container and polygon table now (once per isolate). Rings stay lazy. Harmless if called again. On web, requires installBoundaries first.
findLocation(double longitude, double latitude) → Location?
Returns the package:timezone Location containing (longitude, latitude), or null if no land time zone covers it.
initializeBoundaries([String url = boundariesDefaultUrl]) Future<void>
Fetches url then installBoundaries. Prefer bytes when you already have them.
installBoundaries(Uint8List bytes) → void
Installs packed boundary bytes as the isolate-wide shared index.

Exceptions / Errors

BoundariesInitException
Thrown when initializeBoundaries cannot obtain a valid .bin (HTTP error or wrong size).
IndexFormatException
Thrown when a container cannot be trusted.