checkFdbHelper function

Future<String?> checkFdbHelper()

Checks if fdb_helper extensions are registered in the running app.

Returns the Flutter isolate ID if fdb_helper is available, or null if not. Callers can reuse the returned isolate ID to avoid a second round-trip.

Re-throws AppDiedException so the caller can surface a structured error instead of a misleading "fdb_helper not detected" message.

Implementation

Future<String?> checkFdbHelper() async {
  try {
    final isolateId = await findFlutterIsolateId();
    if (isolateId == null) return null;
    await vmServiceCall(
      'ext.fdb.elements',
      params: {'isolateId': isolateId},
      timeout: const Duration(seconds: 3),
    );
    return isolateId;
  } on AppDiedException {
    rethrow;
  } catch (_) {
    return null;
  }
}