loadSkillZip method

  1. @override
Future<Uint8List?> loadSkillZip(
  1. String name
)

Loads a skill ZIP by its name. Returns the raw ZIP bytes, or null if the skill is not found or the data is corrupt.

Implementation

@override
Future<Uint8List?> loadSkillZip(String name) async {
  final defs = await _loadDefs();
  final info = defs.where((d) => d.name == name).firstOrNull;
  if (info == null) return null;

  final zipPath = '$rootPath${Platform.pathSeparator}${info.zipFileName}';
  final file = File(zipPath);
  if (!await file.exists()) return null;

  try {
    return await file.readAsBytes();
  } catch (_) {
    return null;
  }
}