resolveManifestPath method

Future<String?> resolveManifestPath()

Resolves the absolute path to the bundled install.yaml.

Uses Isolate.resolvePackageUri starting from package:magic_deeplink/magic_deeplink.dart. The barrel lives at <plugin_root>/lib/magic_deeplink.dart, so two parent lookups back out to the plugin root where install.yaml resides.

Returns null when the manifest cannot be located so handle can surface a clean error.

@return The absolute manifest path, or null when not found.

Implementation

Future<String?> resolveManifestPath() async {
  final resolved = await Isolate.resolvePackageUri(
    Uri.parse('package:magic_deeplink/magic_deeplink.dart'),
  );
  if (resolved == null || resolved.scheme != 'file') return null;

  // resolved -> <plugin_root>/lib/magic_deeplink.dart; two parent lookups
  // back out to the plugin root where install.yaml lives.
  final pluginRoot = File(resolved.toFilePath()).parent.parent.path;
  final manifestPath = '$pluginRoot/install.yaml';
  return File(manifestPath).existsSync() ? manifestPath : null;
}