nepal_address & nepal_address_flutter
An offline-first, zero-dependency Dart and Flutter monorepo providing comprehensive administrative division data, bilingual search, structured address formatting, and cascading UI form controls for Nepal's provinces, districts, local levels, and wards.
Author: Pratik Kattel, software developer in Nepal • Publisher on pub.dev: pratikkattel.com.np • License: MIT
Package Features
nepal_address
Pure Dart core • Zero runtime dependencies
- Zero Runtime Dependencies: Pure Dart implementation that runs entirely offline in any Dart or Flutter environment.
- Relational Administrative Hierarchy: Hierarchical relations from Province → District → Local Level → Ward.
- Bilingual Models: English and Nepali (Devanagari) names for every province, district, local level, and local level type.
- Bilingual Search Engine: Search supporting English, Devanagari, and Romanized phonetic spellings, with alias matching and fuzzy tolerance.
- Structured Address Formatting:
SelectedAddressutility for composing, formatting, and serializing addresses in English, Nepali, or bilingual styles. - Dataset Provenance & Metadata: Programmatic access to upstream data sources, release dates, and verification metrics via
DataInfo.
nepal_address_flutter
Flutter UI package • Built on nepal_address
- Cascading Selection: Automatically filters downstream options (Province → District → Local Level → Ward) and resets child selections when parents change without losing widget state.
- Form Integration:
NepalAddressFormFieldintegrates seamlessly into FlutterFormwidgets with automatic validation, save/reset actions, and multilingual error messages. - Standalone Dropdowns: Individual
ProvinceDropdown,DistrictDropdown,LocalLevelDropdown, andWardDropdownwidgets for customized layouts. - Bilingual & Multilingual: Supports English (
english), Nepali (nepali), and Bilingual (bilingual—English / नेपाली) label displays. - Flexible Visibility: Hide or show individual administrative levels with deterministic fallback rules.
- Accessible & Customizable: Built on
DropdownButtonFormFieldwith stable item keys, accessibility semantics labels, and fullInputDecorationtheming.
Installation & Setup
Dart / Server / CLI (Core lookups & search)
dart pub add nepal_addressFlutter Apps (Pickers, dropdowns & form fields)
flutter pub add nepal_address_flutterpubspec.yaml dependencies
dependencies:
nepal_address: ^0.1.0
nepal_address_flutter: ^0.1.0Import statements
import 'package:nepal_address/nepal_address.dart';
import 'package:nepal_address_flutter/nepal_address_flutter.dart';Quick Usage Examples
1. Pure Dart: Data Queries, Bilingual Search & Formatting
nepal_addressimport 'package:nepal_address/nepal_address.dart';
void main() {
// Hierarchical Queries
final districtsInKoshi = NepalAddress.getDistrictsByProvinceId(1);
for (final d in districtsInKoshi) {
print('${d.nameEn} (${d.nameNp})');
}
final localLevelsInBhojpur = NepalAddress.getLocalLevelsByDistrictId(1);
final wardsInShadanand = NepalAddress.getWardsByLocalLevelId(1);
// Bilingual & Phonetic Search
final englishResults = NepalAddress.search('Kathmandu');
final nepaliResults = NepalAddress.search('काठमाडौँ');
final phoneticResults = NepalAddress.search('Katmandu'); // Matches "Kathmandu"
// Structured Address Formatting
final address = SelectedAddress.fromEntities(
province: NepalAddress.getProvinceById(3),
district: NepalAddress.getDistrictById(27),
localLevel: NepalAddress.getLocalLevelById(307),
wardNumber: 1,
);
print(address.en); // "Ward 1, Kathmandu, Kathmandu, Bagmati Province"
print(address.np); // "वडा नं. १, काठमाण्डौं, काठमाडौँ, बाग्मती प्रदेश"
print(address.bilingual); // "Ward 1 (वडा नं. १), Kathmandu (काठमाण्डौं)..."
}2. Flutter: Cascading FormField & AddressPicker
nepal_address_flutterimport 'package:flutter/material.dart';
import 'package:nepal_address/nepal_address.dart';
import 'package:nepal_address_flutter/nepal_address_flutter.dart';
// 1. Integration inside a standard Flutter Form with built-in validation
NepalAddressFormField(
showWard: true,
language: NepalAddressLanguage.bilingual,
requiredLevels: const {
NepalAddressLevel.province,
NepalAddressLevel.district,
NepalAddressLevel.localLevel,
NepalAddressLevel.ward,
},
onSaved: (SelectedAddress? address) {
print('Saved Address: ${address?.bilingual}');
},
)
// 2. Standalone Cascading Picker for custom workflows
NepalAddressPicker(
showWard: true,
language: NepalAddressLanguage.english,
initialValue: const SelectedAddress(provinceId: 1),
onChanged: (SelectedAddress address) {
print('Selected: ${address.en}');
},
)Tech Stack & Engineering Standards
Core package has 0 third-party runtime package dependencies. Pure Dart implementation ensuring fast compilation and minimal bundle size.
nepal_address: Dart >=3.8.0 <4.0.0
nepal_address_flutter: Dart >=3.9.0, Flutter >=3.35.0
Continuous integration tested across minimum SDKs (Dart 3.8.0, Flutter 3.35.0) and latest stable channels, including automated code formatting checks.
Pre-compiled static data tables embedded directly in Dart code. Works 100% offline with zero network requests or local database daemons.
Comprehensive unit and widget tests covering data integrity, search ranking order, phonetic matching, and cascading dropdown state resets.
Published on pub.dev under the publisher domain pratikkattel.com.np with standard semantic versioning (0.1.0).
This dataset is compiled and cross-checked from three open MIT-licensed sources:
sagautam5/local-states-nepal(primary source)younginnovations/nepal-locallevel-map(secondary source)bedbyaspokhrel/nepal-geo-data(tertiary source)
Important: This package is not an official government dataset, nor is it endorsed by the Government of Nepal or the Ministry of Federal Affairs and General Administration (MoFAGA).
A total of 12 known source conflicts in ward counts or municipality classifications could not be reconciled definitively and are cataloged as unverified in the codebase. Spatial boundary polygons, GeoJSON shapes, and centroid coordinates are deliberately excluded to maintain a zero-dependency lightweight pure Dart library.
Repository Links & Resources
pub.dev package page for Pure Dart core
pub.dev package page for Flutter UI
Source code, tests, tools & documentation
Version history for nepal_address
Version history for nepal_address_flutter
Bug reports, feature requests & data aliases

