Tanzania Geo Data
A comprehensive Flutter package for retrieving and searching Tanzanian geographic data, including Regions, Districts, Wards, and Streets. This package provides 100% national coverage, including Mainland and Zanzibar, with integrated postcodes and optimized search.
Features
- National Coverage: Full mapping for all 31 Regions and 170 Districts of Tanzania.
- Enhanced Data: Includes 4,296 Wards and 16,684 Streets with high hierarchical integrity.
- Postcode Integration: Integrated
postCodesupport for Regions, Districts, and Wards. - Clean Naming: Standardized location names (e.g.,
Kinondoni,Arusha CBD). - Postcode Search: Dedicated methods to retrieve locations by their official postcodes.
- Lightweight & Efficient: Static data structures for instant access and zero runtime dependencies.
Data Coverage (v1.0.0)
| Category | Count | Status |
|---|---|---|
| Regions | 31 | 100% (Mainland + Zanzibar) |
| Districts | 170 | Fixed & Standardized |
| Wards | 4,296 | With official Postcodes |
| Streets | 16,684 | Detailed & Linked |
Getting Started
Add this to your pubspec.yaml:
dependencies:
tanzania_geo_data: ^1.0.0
Then run:
flutter pub get
Usage
1. Initialize the Service
import 'package:tanzania_geo_data/tanzania_geo_data.dart';
final geoService = GeoService();
2. Basic Retrieval
// Get all regions
List<Region> regions = geoService.getRegions();
// Get districts in a region (e.g., 'Arusha')
List<District> districts = geoService.getDistrictsByRegion('Arusha');
// Get wards in a district (e.g., 'Kinondoni')
List<Ward> wards = geoService.getWardsByDistrict('Kinondoni');
// Get streets in a ward
List<Street> streets = geoService.getStreetsByWard('Kariakoo');
3. Postcode Lookups (New in v1.0.0)
// Find a region by postcode
Region? region = geoService.getRegionByPostCode('23'); // Arusha
// Find districts by postcode
List<District> districts = geoService.getDistrictsByPostCode('141'); // Kinondoni
// Find wards by postcode
List<Ward> wards = geoService.getWardsByPostCode('47101');
4. Categorized Search
SearchResults results = geoService.search('Dodoma');
print('Found ${results.regions.length} regions');
print('Found ${results.districts.length} districts');
Example Application
Check out the example directory for a complete Flutter application demonstrating cascaded selection and postcode search.
License
This project is licensed under the MIT License - see the LICENSE file for details.