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

# File - IO Utility Extensions

>  Powerful extensions for dart:io.File to simplify size formatting, path manipulation, and type checking for local files.

> [!WARNING]
>
> Methods like `fileFormattedSize()` and `fileToBase64String()` use synchronous I/O (`lengthSync`, `readAsBytesSync`) and should be run off the main thread (e.g., in an `Isolate` or `compute`) for large files to prevent UI jank.

### 1. 🔗 Path & Naming

**filePath()** `String`

Retrieves the absolute path of the file.

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
final path = file.filePath();

//  Output: /data/user/0/app.name/cache/temp.txt
```

**fileExtension()** `String`

Retrieves the file extension (the part after the last dot), e.g., "png", "pdf".

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
print(File('/img/photo.png').fileExtension()); // png
```

**fileNameWithoutExtension()** `String`

Retrieves the file name without the extension. "pdf".

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
print(File('/docs/report.pdf').fileNameWithoutExtension()); // report
```

### 2. 🖼️ Content & Type Checks

**fileToBase64String()** `String`

Reads the file contents synchronously and converts them to a `Base64` encoded string.

```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
final base64 = file.fileToBase64String();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.