validate method

验证配置

Implementation

ConfigValidationResult validate() {
  final errors = <String>[];

  if (network == null) {
    errors.add('network 未配置');
  } else if (network!.baseUrl.isEmpty) {
    errors.add('network.baseUrl 不能为空');
  }

  if (storage == null) {
    errors.add('storage 未配置');
  }

  return errors.isEmpty
      ? ConfigValidationResult.valid()
      : ConfigValidationResult.invalid(errors);
}