DartGov FBI
Empower your Dart applications with seamless access to critical information from the Federal Bureau of Investigation (FBI) using the DartGov FBI SDK. This powerful software development kit provides developers with a straightforward interface to communicate with the FBI's public APIs, specifically tailored for accessing data on wanted persons and art crimes.
Installation
In the pubspec.yaml
of your project, add the following dependency:
dependencies:
dart_gov_fbi: ^0.1.0
Import it to each file you use it in:
import 'package:dart_gov_fbi/dart_gov_fbi.dart';
Usage
The FBI's database can only be accessed in chunks. Rather than dumping the entire thing into your program, you will need to decide how you want to access the information, and what you are looking for.
The database is broken up into pages, which you can access by index (starting at 1). By default, the pages are 50 items in length. That means with 1000 items, the database will have 20 pages.
You can further refine your search by changing the page size, or the number of items per page. Let's say you change the page size to 10 (instead of 50). Now the same database with 1000 items will have 100 pages (instead of 20). The data is the same, what changes is how it is packaged up and sent to you. This means that with a page size of 10, pages 1 - 5 will have the same data as page 1 when using a page size of 50.
Warning: If you try and access their database too many times in a short time span, they will lock you out for a while. Only pull what you need, or risk triggering their CloudFlare lockout.
Example 1 - Fetching a page of data
This example show a few ways to fetch a single page of data.
// Fetch page 1 with page size 50
fetchArtCrimes(); // Art crimes
fetchWantedPersons(); // Wanted persons
// Fetch page 3 with page size 50
fetchArtCrimes(page: 3); // Art crimes
fetchWantedPersons(page: 3); // Wanted persons
// Fetch page 3 with page size 25
fetchArtCrimes(page: 3, pageSize: 25); // Art crimes
fetchWantedPersons(page: 3, pageSize: 25); // Wanted persons
// Fetch the last page by reversing the order
fetchArtCrimes(
sortDirection = ArtCrimeSortDirection.ascending,
);
fetchWantedPersons(
sortDirection = WantedPersonSortDirection.ascending,
);
Example 2 - Fetch specific item
If you already have the ID of an item you want, you can directly fetch that item from the database.
fetchArtCrime('artCrimeId_123'); // Art crime
fetchWantedPerson('wantedPersonId_123'); // Wanted person
If you found this helpful, please consider donating. Thanks!
Libraries
- constants/api_fields
- dart_gov_fbi
- domain/models/fbi_image
- features/art_crime/domain/models/art_crime
- features/art_crime/domain/models/art_crime_result_set
- features/art_crime/domain/repos/art_crime_repo
- features/art_crime/domain/services/art_crime_service
- features/wanted_person/domain/models/wanted_person
- features/wanted_person/domain/models/wanted_person_coordinates
- features/wanted_person/domain/models/wanted_person_file
- features/wanted_person/domain/models/wanted_person_result_set
- features/wanted_person/domain/repos/wanted_person_repo
- features/wanted_person/domain/services/wanted_person_service
- utils/equality_tool
- utils/json_tool
- utils/url_tool