# AssertionError: 'file:///...' is not a valid URI

- **ID:** `flutter/invalid-uri-assertion`
- **Domain:** flutter
- **Category:** assertion_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Using a malformed URI string (e.g., missing scheme or double slashes) when constructing a Uri object.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.0.0 | active | — | — |
| 3.7.0 | active | — | — |
| 3.16.0 | active | — | — |

## Workarounds

1. **Use Uri.file() to create file URIs correctly from a file path.** (95% success)
   ```
   Use Uri.file() to create file URIs correctly from a file path.
   ```
2. **Validate and sanitize the URI string before parsing with Uri.parse().** (85% success)
   ```
   Validate and sanitize the URI string before parsing with Uri.parse().
   ```
3. **Use path_provider to get correct paths and then convert to URI.** (90% success)
   ```
   Use path_provider to get correct paths and then convert to URI.
   ```

## Dead Ends

- **** — Does not address the root cause of missing or malformed scheme (e.g., 'file:///path' vs 'file:///C:/path'). (40% fail)
- **** — Uri.parse requires absolute URIs; relative paths cause assertion errors. (35% fail)
- **** — Without a scheme, the URI is invalid; the platform may misinterpret the path. (25% fail)
