Skip to content

Does not catch/report "Network is unreachable" errors on Android #20

Open
@fernando-s97

Description

@fernando-s97
Future<bool> _ping() async {
    try {
      final results = await Ping(ipAddress, count: 4).stream.toList();

      if (results.isEmpty) {
        return false;
      }

      final summary = results.last.summary!;
      final successRate = summary.received / summary.transmitted;
      return successRate > 0.5;
    } catch (e) {
      return false;
    }
  }

The code above always return immediately, doesn't matter if I set the count to 4 or 40. The result is always empty and immediate.

I'm using an Android 11 and the ipAddress is from an iot device (without internet) that I'm connected to.

Also, when using emulated terminals I get "Network is unreachable", but my app can properly communicate with the device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions