> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markpdf.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Your first conversion with the Flutter/Dart package in less than 15 lines.

# Quickstart

## Convert a `File` (mobile/desktop)

`convertFile` uses `dart:io` `File` and uploads the document by multipart to `POST /convert`. Only available on platforms with filesystem access (not Flutter Web).

```dart theme={null}
import 'dart:io';
import 'package:markpdf/markpdf.dart';

final client = MarkpdfClient(apiKey: 'YOUR_API_KEY');

final file = File('/ruta/report.pdf');
final result = await client.convertFile(file, options: ConvertOptions(mode: ConversionMode.fast));

if (result is MarkdownResult) {
  print(result.markdown);
}
```

## Convert bytes (recommended for Flutter Web)

`convertBytes` receives a `Uint8Array` (for example, from `image_picker` or `file_picker`) and works on all platforms, including Web:

```dart theme={null}
import 'package:markpdf/markpdf.dart';

final client = MarkpdfClient(apiKey: 'YOUR_API_KEY');

final Uint8List bytes = await pickedFile.readAsBytes();
final result = await client.convertBytes(bytes, pickedFile.name);

if (result is MarkdownResult) {
  print(result.markdown);
}
```

<Tip>
  In Flutter Web there is no `dart:io.File`, so `convertBytes` is the recommended route there. On mobile/desktop you can use either of the two depending on where the file comes from.
</Tip>

## Convert from URL

```dart theme={null}
final result = await client.convertFromUrl(
  'https://bucket.example.com/report.pdf?sig=...',
  filename: 'report.pdf',
  options: ConvertOptions(mode: ConversionMode.fast),
);
```

## Request metadata in addition to Markdown

```dart theme={null}
final result = await client.convertFile(
  file,
  options: ConvertOptions(responseFormat: ResponseFormat.json),
);

if (result is JsonConvertResult) {
  print(result.result.markdown);
  print(result.result.engine);
  print(result.result.timings.totalRequestMs);
}
```

`ConvertResult` is a sealed class: use `if (result is MarkdownResult)` or an exhaustive `switch` to unpack it. See [Reference](/docs/sdks/flutter/reference).

## Siguiente paso

* [Full customer reference](/docs/sdks/flutter/reference)
* [Asynchronous Jobs (202)](/docs/sdks/flutter/streaming-and-async)
* [Error Handling](/docs/sdks/flutter/error-handling)
