Dartvel, home
Docs
Features
Studio
Cloud
Compared

Search the site

GitHub
pub.dev

GETTING STARTED

Getting started
Existing Flutter apps
Existing Native apps
Run on your phone

APP

UI and styling
Routing
State
Accessibility
Keyboard shortcuts
Localization
Devices and desktop
Native device access
Media, 3D and XR

DATA

Data models
Forms
Search
Sync and offline
Import and export
Change capture
Database
Cache
File storage
Images
Privacy and erasure

BACKEND

Backend functions
Auth and sessions
Authorization
Queues and jobs
Workers and memory
Notifications and mail
Outbound HTTP
AI
Webhooks
GraphQL and OpenAPI
API keys and OAuth
Multi-tenancy
Billing and commerce
Modules

OPERATIONS

Edge security
Secrets and environments
Monitoring
Releases

SHIPPING

Build targets
Telegram Mini Apps
Static web hosting
Servers and deploying

REFERENCE

Testing
CLI reference
Coding agents

BACKEND

Outbound HTTP

Declare each API your app calls once, with its timeout and retries.

A call to a host you did not declare is refused before anything is sent.

ON THIS PAGE

Declare a host

Call a declared host

Undeclared hosts are refused

Status

Declare a host

# pubspec.yaml
dartvel:
  http:
    hosts:
      paystack:
        baseUrl: https://api.paystack.co
        timeout: 10s
        retries: { attempts: 2, backoff: exponential }

Copy code to clipboard

auth: { bearer: SECRET_NAME } sends a secret as a bearer token.

headers, circuitBreaker and pool: { maxConcurrent } are there too.

An unknown key stops the build.

Call a declared host

final Response response =
    await DV.Http.host('paystack').get('/transaction/verify/$reference');
final Object? data = await response.body!.jsonDecode();

Copy code to clipboard

get, head and delete take a path. post, put and patch also take json: or body:.

Pass idempotencyKey: to retry a POST safely.

The response is a standard Response with status, headers and body.

Undeclared hosts are refused

A literal URL no declared host covers stops dartvel routes with DV-HTTP-001. A URL built at run time is refused when the call runs.

try {
  // A URL known only at run time is checked when it runs.
  await DV.Http.get(url);
} on DVHttpUndeclaredHostException catch (error) {
  // DV-HTTP-001: no declared host covers this URL, and nothing was sent.
  DV.log(error.toString());
}

Copy code to clipboard

Status

Partial

Spec section: Outbound HTTP

Planned work and implementation limits

The build checks literal URLs only.

Bearer is the only auth scheme.

Backend code uses const DVHttp(), because DV is not available there.

PREVIOUS Notifications and mail Email, in-app and push through one service
NEXT AI Chat, structured output, embeddings and tools
GitHub
pub.dev
npm
Acknowledgements
Privacy
Terms

FSL-1.1-MIT licensed. Built with Dartvel.

Dartvel is made by

SigmaDev Digital

To the bottom