Mark Android-only external-storage blocks coverage:ignore

getExternalStorageDirectory() is unavailable on the Linux test host, so the
Platform.isAndroid fallback blocks in sync_service/http_server_service can't be
exercised in CI. Wrap them in coverage:ignore (honored by flutter test
--coverage) so the 100% gate doesn't demand coverage of an Android-only path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PM3auNTifaVgcXWDizZrjH
This commit is contained in:
Krzysztof Rudnicki 2026-07-13 13:18:19 +02:00
parent 77151c0013
commit 5b3b15f73c
2 changed files with 8 additions and 0 deletions

View File

@ -70,6 +70,9 @@ class HttpServerService {
// External storage is Android-only; getExternalStorageDirectory() throws an
// UnsupportedError (not an Exception) on other platforms (desktop / test
// host), so guard the call rather than trying to catch it.
// coverage:ignore-start
// Android-only: getExternalStorageDirectory is unavailable on the Linux
// test host, so this block can't be exercised in CI.
if (Platform.isAndroid) {
try {
final dir = await getExternalStorageDirectory();
@ -77,6 +80,7 @@ class HttpServerService {
} on Exception {
// Ignore; the /sdcard path is tried first.
}
// coverage:ignore-end
}
for (final path in candidates) {
final file = File(path);

View File

@ -31,6 +31,9 @@ class SyncService {
// External storage is Android-only; getExternalStorageDirectory() throws an
// UnsupportedError (not an Exception) on other platforms, so guard the call.
// coverage:ignore-start
// Android-only: getExternalStorageDirectory is unavailable on the Linux
// test host, so this block can't be exercised in CI.
if (Platform.isAndroid) {
try {
final dir = await getExternalStorageDirectory();
@ -43,6 +46,7 @@ class SyncService {
// Fallback failed.
}
}
// coverage:ignore-end
return const SyncResult(
success: false,