pihole_api 0.1.4 pihole_api: ^0.1.4 copied to clipboard
Provides models and endpoint wrappers for the Pi-hole API (summary, queries, versions etc.).
Pi-hole API #
A Flutter library for the Pi-hole API.
Used in the FlutterHole app.
Example #
The following example prints the summary information after fetching it.
Note: Do not forget to add your own API token.
final dio = Dio();
final pihole = PiholeRepositoryDio(PiholeRepositoryParams(
dio: dio,
baseUrl: "http://pi.hole",
apiPath: "/admin/api.php",
apiPort: 80,
apiTokenRequired: true,
apiToken: "API_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