SharedOptions.formJSON constructor

SharedOptions.formJSON(
  1. Map? json
)

Implementation

factory SharedOptions.formJSON(Map? json) {
  return SharedOptions(
    libPaths: json?[libPathOption.name] is List
      ? List<String>.from(json![libPathOption.name])
      : [],
    assetPaths: json?[assetPathOption.name] is List
      ? List<String>.from(json![assetPathOption.name])
      : [],
    dustbinPath: (json?[dustbinPathOption.name] as String?) ?? '',
    listPath: (json?[listPathOption.name] as String?) ?? '',
    configPath: (json?[configPathOption.name] as String?) ?? '',
    nameReplaces: json?[nameReplaceOption.name] is Map
      ? Map<String, String?>.from(json![nameReplaceOption.name])
      : {},
    excludePaths: json?[excludePathOption.name] is List
      ? List<String>.from(json![excludePathOption.name])
      : [],
    formatType: json?[formatTypeOption.name] is String
      ? FormatType.values.firstWhere((FormatType type) => type.toString().contains(json![formatTypeOption.name]))
      : null,
  );
}