afrihex library

The AfriHex API for Dart and Flutter: Ghana addresses and landmark directions, routing and fleet planning, delivery tracking, cash on delivery, pricing, proof of delivery, service areas and hex codes.

Classes

AccountModule
AddressDescriptor
AddressesModule
AddressParseResponse
AddressSuggestion
One row in a suggestion list.
AfriHex
The AfriHex API client.
AfriHexAddress
A delivery address, ready to save with an order or pass to trips.create.
AltRoute
Anchor
AutocompleteResponse
AutocompleteResult
BridgeModule
BulkQuoteRequest
BulkQuoteResult
CashModule
CashReconciliation
CashReconciliationRow
CashReconciliationTotals
CashRemittance
CashRemittanceRequest
DeliveryModule
DeliveryQuote
DeliveryQuoteRequest
DescriptorArea
DescriptorLandmark
Destination
GeocodeMatch
One landmark from landmarks.geocode. score is set for name searches, distanceM for searches around an anchor.
GeoPoint
HexBridge
A GhanaPostGPS code and the hex code for the same place.
HexCells
The cells around, inside or between hex codes.
HexLocation
A hex cell: AfriHex's own short location code.
HexModule
LandmarkGeocodeResponse
LandmarkPassed
LandmarksModule
LatLng
A point: latitude and longitude in degrees.
Location
NewTestKey
A new test key. key is shown once.
Parsed
PlanBreak
PlanCost
PlanJob
PlannedRoute
PlannedStep
PlanShipment
PlanVehicle
PODConfirmRequest
PODConfirmResponse
PODDestination
PODIssueRequest
PODIssueResponse
PodModule
PODPoint
PODReceipt
PODReceiptEnvelope
PODRecord
PODVerifyResult
PricingRulesResponse
PricingZone
Provenance
QuoteLine
QuoteParcel
QuoteRoute
RequestOptions
Per-call options, accepted as the last argument where a method takes one.
ResolvedPoint
ReverseResult
The address at a point, from addresses.reverse. With descriptors: true it also carries landmark directions such as "Opposite Nick Petroleum filling station, Gbatsuna".
RiderCashBalance
RouteEndpoint
RouteLane
RouteLeg
RoutePlanOptions
RoutePlanRequest
RoutePlanResponse
RoutePlanSummary
RouteRequest
RouteResponse
RouteStep
RoutingModule
Rules
SearchResponse
SearchResult
ServiceAreaBulkCheckRequest
ServiceAreaBulkCheckResponse
ServiceAreaBulkItemResult
ServiceAreaCheckRequest
ServiceAreaCheckResponse
ServiceAreaCreateRequest
ServiceAreaMatch
ServiceAreaResponse
ServiceAreasModule
ShipmentStop
SMSUsage
Surcharge
TestKeyStatus
Whether the account has a test-mode key (afx_test_…).
TimeWindow
Trip
TripAmountRequest
TripAttempt
TripAttemptRequest
TripCall
TripCollection
TripCollectionRequest
TripCollectionSummary
TripCreateRequest
TripDelay
TripETA
TripEvent
TripLocationRequest
TripNotification
TripPlace
TripPosition
TripRecipientReply
TripRecipientReplyRequest
TripsModule
TripStatusRequest
TripTracking
TruckSpec
UnassignedStop
VoidRequest
WebhookEndpoint
A webhook endpoint on your account. The secret is never returned.
WebhookEvent
A webhook from AfriHex. Trip events (trip.*) carry the trip as it is now in trip and what changed in detail; other events (pod.confirm, drift…) are in data.
WebhooksModule

Enums

AddressSource
How an AfriHexAddress was found.

Constants

sdkVersion → const String
The SDK version, sent in the User-Agent.

Functions

formatGpsCode(String code) → String
"GA1838164" or "ga-183-8164" → "GA-183-8164". Anything else comes back upper-cased.
hasDirections(String q) → bool
Ghanaian-style directions: "opposite Goil, Madina", "behind the police station".
isGpsCode(String q) → bool
Looks like a GhanaPostGPS code: two letters, then 7–8 digits, dashes optional.
verifyWebhook(String rawBody, Map<String, String> headers, String secret, {Duration tolerance = const Duration(minutes: 5), DateTime? now}) → WebhookEvent
Checks that a webhook really came from AfriHex and returns the event. Throws AfriHexException with code INVALID_SIGNATURE otherwise; reply 400.

Exceptions / Errors

AfriHexException
An error from the AfriHex API, or from reaching it.