pihole_api 0.3.1 copy "pihole_api: ^0.3.1" to clipboard
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
110
pub points
0%
popularity

Publisher

verified publishertster.nl

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

clock, dio, freezed_annotation, html, http_mock_adapter, json_annotation

More

Packages that depend on pihole_api