getCachedArtifacts method

Future<List<Map<String, Object?>>> getCachedArtifacts(
  1. NativeStepFingerprint fingerprint
)

Retrieve cached artifact declarations for a step.

Returns the JSON-serializable artifact declarations stored when the step was last executed. Returns an empty list if not cached.

Implementation

Future<List<Map<String, Object?>>> getCachedArtifacts(
  NativeStepFingerprint fingerprint,
) async {
  final metaFile = _metaFile(fingerprint);
  if (!metaFile.existsSync()) return [];

  try {
    final json =
        jsonDecode(await metaFile.readAsString()) as Map<String, dynamic>;
    final declarations = json['artifactDeclarations'];
    if (declarations is List) {
      return declarations.cast<Map<String, Object?>>();
    }
  } catch (_) {}
  return [];
}