pihole_api 0.3.1 icon indicating copy to clipboard operation
pihole_api: ^0.3.1 copied to clipboard

Provides models and endpoint wrappers for the Pi-hole API (summary, queries, versions etc.).

Pi-hole API #

Pub Build codecov License

A Flutter library for the Pi-hole API.

Example #

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(
    "PIHOLE_API_TOKEN",
    defaultValue: "MY_TOKEN",
  ),  
  allowSelfSignedCertificates: false,
  adminHome: "/admin",
));
pihole.fetchSummary(CancelToken()).then((summary) => print(summary.toString()));

Development #

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

Changelog #

standard-version --release-as x.y.z
0
likes
120
pub points
28%
popularity

Publisher

verified publisher icontster.nl

Provides models and endpoint wrappers for the Pi-hole API (summary, queries, versions etc.).

Repository (GitHub)

License

Icon for licenses.BSD-3-Clause (LICENSE)

Dependencies

clock, dio, freezed_annotation, html, http_mock_adapter, json_annotation

More

Packages that depend on pihole_api