Nigerian States Geography

A Flutter package that provides a list of Nigeria states and their capitals.

Features

  • List of States: Provides a comprehensive list of all Nigerian states.
  • State and Capital : Includes a model of both state and capital.
  • Data Loading: Loads state data from a local JSON file for efficient and offline access.
  • Clean and Well-Documented Code: Includes Dartdoc comments for easy understanding and API documentation generation.

Usage

  1. Add the package as a dependency to your pubspec.yaml:

    dependencies:
      nigeria_states_geography: <latest_version> 
    
  2. Import the package in your Dart file:

    import 'package:nigeria_states_geography/nigeria_states_geography.dart';
    
  3. Use the getAllStatesAndCapitals() function:

    Future<void> _loadStates() async {
      try {
        final states = await getAllStatesAndCapitals(); 
        setState(() {
          _states = states; 
        });
      } catch (e) {
                print('Error loading states: $e');
    
             SnackBar(
        content: Text(
          e.toString(),
        ),
      );
      }
    }
    
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        // ... your UI using the _states list or check the example folder for usage
      );
    }
    

Documentation

  • API Documentation: Generated API documentation is available in the doc directory.

Installation

flutter pub get

Libraries

models/states_capital_model
Represents a Nigerian State with its name and capital.
nigeria_states_geography