# Flutter

MuxForms on Flutter sends an HTTP POST from your contact screen to /api/v1/forms/{id}/submit with Content-Type application/json and the ingest secret header. No Flutter plugin required.

## Flutter

| Piece | Detail |
| --- | --- |
| package:http | POST JSON |
| Field names | Match schema |
| Secret | flutter_dotenv or backend |
| 422 | Decode errors map to TextFormField |

## contact_screen.dart

```
import 'dart:convert';
import 'package:http/http.dart' as http;

Future<void> submitContact({required String email, required String message}) async {
  const formId = 'FORM_UUID';
  const secret = String.fromEnvironment('MUXFORMS_INGEST_SECRET');
  final uri = Uri.parse('https://www.muxforms.com/api/v1/forms/$formId/submit');
  final res = await http.post(
    uri,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer $secret',
    },
    body: jsonEncode({
      'email': email,
      'message': message,
      'platform': 'flutter',
      '_hp': '',
    }),
  );
  if (res.statusCode != 200) {
    throw Exception('Submit failed: ${res.statusCode}');
  }
}
```

## FAQ

### Web Flutter?

Web builds can use embed in HtmlElementView—or POST like mobile.

### iOS ATS?

muxforms.com is HTTPS; no exception needed.

### Background isolate?

Submit from UI isolate; no special SDK.

### Firebase together?

MuxForms is intake; Firebase can still handle auth.

---

HTML version: https://www.muxforms.com/docs/flutter
Source: MuxForms (https://www.muxforms.com)
