HooksWorkflowConfig.fromMap constructor

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

Builds hook config from a map.

Implementation

factory HooksWorkflowConfig.fromMap(Map<String, dynamic> map) {
  final shellArgsRaw = map['shell_arguments'];
  final shellArgs = shellArgsRaw is List<dynamic>
      ? List<String>.unmodifiable(shellArgsRaw.whereType<String>())
      : null;
  return HooksWorkflowConfig(
    afterCreate: _stringValue(map, 'after_create'),
    beforeRun: _stringValue(map, 'before_run'),
    afterRun: _stringValue(map, 'after_run'),
    beforeRemove: _stringValue(map, 'before_remove'),
    timeout: Duration(milliseconds: _intValue(map, 'timeout_ms') ?? 60000),
    shellExecutable: _stringValue(map, 'shell'),
    shellArguments: shellArgs,
  );
}