fromPlatformBlock static method
Reads the pre_command and post_command of the build or publish of a platform
The where is the path of the block, e.g. platforms.ios.build, used in the errors
Implementation
static (HookCommands?, List<BPConfigValidationError>) fromPlatformBlock(dynamic block, String where) {
if (block is! Map) return (const HookCommands(), []);
List<String> errors = [];
String? pre = block.containsKey("pre_command") ? _command(block["pre_command"], "$where.pre_command", errors) : null;
(String?, String?) post = block.containsKey("post_command") ? _post(block["post_command"], "$where.post_command", errors) : (null, null);
if (errors.isNotEmpty) return (null, _toErrors(errors));
return (HookCommands(pre: pre, onSuccess: post.$1, finallyCommand: post.$2), []);
}