CommandStep.fromMap constructor

CommandStep.fromMap(
  1. Map<String, dynamic> map
)

Creates a CommandStep from a YAML-derived map.

Implementation

factory CommandStep.fromMap(Map<String, dynamic> map) {
  return CommandStep(
    id: map['id'] as String,
    commands: (map['commands'] as List<dynamic>)
        .map(
          (cmd) => (cmd as List<dynamic>).map((e) => e.toString()).toList(),
        )
        .toList(),
    workingDirectory: map['working_directory'] as String?,
    environment: map['environment'] is Map
        ? Map<String, String>.from(
            (map['environment'] as Map).map(
              (k, v) => MapEntry(k.toString(), v.toString()),
            ),
          )
        : null,
  );
}