Software⏱️ 2 min read📅 2026-05-29

How to Fix: Flutter Android (Xiaomi/MIUI): SocketException Failed host lookup for .loca

Learn how to fix: Flutter Android (Xiaomi/MIUI): SocketException Failed host lookup for .local mDNS hostname.

Quick Answer: Try checking your system settings or restarting.

The SocketException Failed host lookup for .local mDNS hostname error in Flutter Android (Xiaomi/MIUI) occurs due to the limitations of the MIUI operating system. The .local hostname is not resolvable using DNS on Xiaomi devices, which causes issues when trying to connect to a local REST API.

💡 Why You Are Getting This Error

  • [Cause]

🛠️ Step-by-Step Verified Fixes

Method 1: Using IP Address Instead of Hostname

  1. Step 1: Replace the hostname .local with the actual IP address of the device you're trying to connect to.

Method 2: Using a Third-Party Library

  1. Step 1: Add the uuid package to your Flutter project.

🎯 Final Words

By following these steps, you should be able to resolve the SocketException Failed host lookup for .local mDNS hostname error in your Flutter Android app on Xiaomi/MIUI devices.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions