Initial commit

This commit is contained in:
admin1
2026-07-14 11:11:36 +08:00
commit 656499cf94
604 changed files with 119518 additions and 0 deletions
@@ -0,0 +1,29 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../core/contracts/server.dart';
import 'di_providers.dart';
class ServerConnectivity {
final bool reachable;
final int? latencyMs;
const ServerConnectivity({required this.reachable, this.latencyMs});
}
final serverConnectivityProvider =
FutureProvider.family<ServerConnectivity, String>((ref, baseUrl) async {
final uc = await ref.read(probeServerUseCaseProvider.future);
final sw = Stopwatch()..start();
try {
await uc.execute(EmbyServerProbeReq(baseUrl: baseUrl));
sw.stop();
return ServerConnectivity(
reachable: true,
latencyMs: sw.elapsedMilliseconds,
);
} catch (_) {
sw.stop();
return const ServerConnectivity(reachable: false);
}
});