Pi-hole API

Pub Build codecov License

A Flutter library for the Pi-hole API.


The following example prints the summary information after fetching it.

Note: Do not forget to add your own API token if you use authenticated requests.

import 'package:pihole_api/pihole_api.dart';

final pihole = PiholeRepositoryDio(PiholeRepositoryParams(
  baseUrl: "http://pi.hole",
  apiPath: "/admin/api.php",
  apiTokenRequired: true,
  // Find the API token from your Pi-hole admin dashboard while signed in, 
  // e.g. from http://pi.hole/admin/scripts/pi-hole/php/api_token.php.
  apiToken: const String.fromEnvironment(
    defaultValue: "MY_TOKEN",
  allowSelfSignedCertificates: false,
  adminHome: "/admin",
pihole.fetchSummary(CancelToken()).then((summary) => print(summary.toString()));


The models are built by freezed. To build the models, use build_runner:

flutter pub run build_runner build
# or
flutter pub run build_runner build --delete-conflicting-outputs


standard-version --release-as x.y.z