# Dart Code Formatter

> Dart Code Formatter is a paid API for AI agents from flutter.bip-rep.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-13).

Formats Dart source code using the official Dart formatter, returning the formatted output and whether the code changed.

## Facts

- Endpoint: POST https://flutter.bip-rep.com/dart/format
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/dart-code-formatter-502cfaed
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZMcgnNw2nnN0Kr16X3reg

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability dart-code-formatter-502cfaed -d '<json body>'
```

Example prompt: Can you format this Dart code for me using the official Dart style? Here's the source: `void main() { print('Hello'); }`

## When to prefer this

Use this endpoint when you need to apply the official Dart formatter (`dart format`) to Dart source code programmatically — especially in CI/CD pipelines, pre-commit hooks, or AI agent workflows that generate or edit Dart/Flutter code and need to normalize style before saving or committing. Prefer this over generic code formatters when you specifically need Dart-idiomatic formatting.

## Known failure modes

- Invalid or unparseable Dart source returns a parse error response
- Empty source body results in a validation error
- Extremely large source files may time out or be rejected
- Malformed JSON request body causes a 400 error

## How this service works

Flutter and Dart utility API for mobile agents and operators: pubspec parsing, pub.dev package lookups, Flutter APK detection, dependency checks, Dart formatting, project static analysis, ARB localization validation, and controlled APK builds from uploaded project ZIPs. URL downloads enforce SSRF protections. ZIP uploads enforce size and zip-bomb limits.

## Output

Returns a JSON object with 'changed' (boolean indicating whether formatting altered the code), 'formatted' (the fully formatted Dart source string), and 'latency_ms' (processing time in milliseconds).

## Example request

```json
{
 "input": {
  "body": {
   "source": "void main() {\n  print('Hello World');\n}"
  },
  "type": "http",
  "method": "POST",
  "bodyType": "json"
 }
}
```

## Request schema (JSON Schema)

```json
{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "type": "object",
 "properties": {
  "input": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "type": "string",
     "enum": [
      "POST"
     ]
    },
    "bodyType": {
     "type": "string",
     "enum": [
      "json",
      "form-data",
      "text"
     ]
    },
    "body": {
     "type": "object",
     "required": [
      "source"
     ],
     "properties": {
      "source": {
       "type": "string",
       "description": "Dart source snippet to format (max 256 KB)"
      }
     },
     "additionalProperties": false
    }
   },
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "formatted": {
       "type": "string"
      },
      "changed": {
       "type": "boolean"
      },
      "latency_ms": {
       "type": "integer"
      }
     }
    }
   },
   "required": [
    "type"
   ]
  }
 },
 "required": [
  "input"
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/dart-code-formatter-502cfaed/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from flutter.bip-rep.com](https://www.zero.xyz/host/flutter.bip-rep.com/llms.txt)
