loadCurrentState method

Future<ReleaseStateRecord?> loadCurrentState(
  1. String projectPath
)

Loads current active release state for projectPath, if present.

Implementation

Future<ReleaseStateRecord?> loadCurrentState(String projectPath) async {
  final filePath = getCurrentStateFilePath(projectPath);
  final file = File(filePath);

  if (await file.exists()) {
    try {
      final content = await file.readAsString();
      final json = jsonDecode(content) as Map<String, dynamic>;
      return ReleaseStateRecord.fromJson(json);
    } catch (_) {}
  }
  return null;
}