np_address library

Nepal administrative address data and picker package.

Provides models and query APIs for Province, Zone, District, Municipality (Local Level), and Ward data with English and Nepali Unicode support, alongside cascading Dropdown, Dialog, and BottomSheet address pickers.

Quick Start

import 'package:np_address/np_address.dart';

// 1. Pure Dart Data Layer
final service = NpAddressService();
final provinces = service.provinces;
final districts = service.getDistrictsByProvince(1);

// 2. Flutter Cascading Dropdown / Dialog / BottomSheet Picker
NpAddressPicker(
  language: AddressLanguage.both,
  pickerMode: AddressPickerMode.dropdown,
  onSelected: (value, level) => print('$level: $value'),
)

// 3. Searchable Modal Dialog / Bottom Sheet
final selectedDistrict = await showNpAddressBottomSheet<District>(
  context: context,
  title: 'Select District',
  items: service.districts,
);

Classes

District
Immutable model representing a District (जिल्ला) of Nepal.
Municipality
Immutable model representing a Municipality / Local Level (स्थानीय तह) of Nepal.
NpAddressPicker
A customizable Nepal administrative address picker widget.
NpAddressService
Service for querying Nepal's administrative division data.
NpAddressTheme
Styling configuration for np_address components.
NpAddressThemeScope
InheritedWidget providing NpAddressTheme down the tree.
Province
Immutable model representing a Province (प्रदेश) of Nepal.
Ward
Represents a ward number within a Municipality.
Zone
Immutable model representing a Zone (अञ्चल) of Nepal.

Enums

AddressLanguage
Language mode for displaying address names in widgets and lookups.
AddressLevel
Represents administrative division levels for filtering and display.
AddressPickerMode
UI presentation mode for selecting Nepal address entities.

Functions

showNpAddressBottomSheet<T>({required BuildContext context, required String title, required List<T> items, T? selectedItem, AddressLanguage language = AddressLanguage.english, String searchHint = 'Search...', NpAddressTheme? theme}) → Future<T?>
Shows a searchable modal bottom sheet to select an address entity.
showNpAddressDialog<T>({required BuildContext context, required String title, required List<T> items, T? selectedItem, AddressLanguage language = AddressLanguage.english, String searchHint = 'Search...', NpAddressTheme? theme}) → Future<T?>
Shows a searchable modal dialog to select an address entity.

Typedefs

AddressSelectionCallback = void Function(String value, AddressLevel level)
Callback fired when an address value is selected with its AddressLevel.