copyWith method

FilePickerModel copyWith({
  1. String? currentDirectory,
  2. List<String>? allowedTypes,
  3. bool? fileAllowed,
  4. bool? dirAllowed,
  5. bool? showHidden,
  6. bool? showPermissions,
  7. bool? showSize,
  8. int? height,
  9. bool? autoHeight,
  10. String? cursor,
  11. FilePickerKeyMap? keyMap,
  12. FilePickerStyles? styles,
  13. List<FileEntry>? files,
  14. int? selected,
  15. int? min,
  16. int? max,
  17. String? selectedPath,
  18. bool clearSelectedPath = false,
  19. List<ViewState>? selectedStack,
  20. int? id,
  21. String? errorMessage,
  22. bool clearError = false,
})

Creates a copy of this model with the given fields replaced.

Implementation

FilePickerModel copyWith({
  String? currentDirectory,
  List<String>? allowedTypes,
  bool? fileAllowed,
  bool? dirAllowed,
  bool? showHidden,
  bool? showPermissions,
  bool? showSize,
  int? height,
  bool? autoHeight,
  String? cursor,
  FilePickerKeyMap? keyMap,
  FilePickerStyles? styles,
  List<FileEntry>? files,
  int? selected,
  int? min,
  int? max,
  String? selectedPath,
  bool clearSelectedPath = false,
  List<ViewState>? selectedStack,
  int? id,
  String? errorMessage,
  bool clearError = false,
}) {
  return FilePickerModel._(
    currentDirectory: currentDirectory ?? _currentDirectory,
    allowedTypes: allowedTypes ?? _allowedTypes,
    fileAllowed: fileAllowed ?? _fileAllowed,
    dirAllowed: dirAllowed ?? _dirAllowed,
    showHidden: showHidden ?? _showHidden,
    showPermissions: showPermissions ?? _showPermissions,
    showSize: showSize ?? _showSize,
    height: height ?? _height,
    autoHeight: autoHeight ?? _autoHeight,
    cursor: cursor ?? _cursor,
    keyMap: keyMap ?? _keyMap,
    styles: styles ?? _styles,
    files: files ?? _files,
    selected: selected ?? _selected,
    min: min ?? _min,
    max: max ?? _max,
    selectedPath: clearSelectedPath ? null : (selectedPath ?? _selectedPath),
    selectedStack: selectedStack ?? _selectedStack,
    id: id ?? _id,
    errorMessage: clearError ? null : (errorMessage ?? _errorMessage),
  );
}