file_type_plus 1.1.0
file_type_plus: ^1.1.0 copied to clipboard
Categorize files into high-level types (image, audio, video, document, HTML, archive) from extensions, MIME types, paths, URLs, or magic-number bytes.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.0 - 2026-07-12 #
Fixed #
FileType.fromExtensionOrMime()now truly prefersextensionovermimeTypewhen both are provided (previously the category order inFileType.valuescould make the MIME type win, e.g. extensionmp3+ MIMEimage/jpegreturned image instead of audio)FileType(ExtensionGroupFilter)no longer crashes with a null-check error when given a custom filter; the extension map is computed from the filterFileType.fromPath()no longer throwsFormatExceptionon unparseable input; it returnsFileType.otheras documentedFileType.fromPath()now detects local file names containing#or?(e.g.my#file.mp4)- Archive detection no longer misclassifies unrelated MIME types via loose
substring matching (
application/marc,application/vnd.stardivision.*,application/vnd.ahead.space, and others); matching is now by exact MIME type or well-defined suffix gzandtgzare now detected as archives (missing from themimepackage's extension map)
Changed #
- MIME type matching ignores parameters (
text/html; charset=utf-8now detects as html) and falls back to category-prefix classification for unlisted types (image/x-customnow detects as image) fromExtensionOrMime()tolerates a leading dot inextension(.jpg)FileType.extensionMap,FileType.values, andExtensionsGrouping.categorizedExtensionsare now unmodifiable (mutating them previously corrupted detection globally)- Legacy StarOffice/OpenOffice.org MIME types now classify as document
- Minimum Dart SDK is now declared as
^3.2.0(the previous>=2.12.0claim was never satisfiable given themime ^2.0.0dependency)
Deprecated #
FileType.isAnyType()— comparesruntimeTypeonly, which breaks for subclasses; useischecks orisAny()instead
Development #
- Enabled
dart_flutter_team_lintsinanalysis_options.yaml(it was declared as a dev dependency but never included) and fixed all findings - Added regression tests for all fixes (105 tests total)
1.0.1 - 2026-02-03 #
Documentation #
- Added platform support badge to README (Android, iOS, macOS, Windows, Linux, Web)
- Simplified code examples in README and example documentation by removing redundant null parameters
- Updated installation instructions to reference version 1.0.1
Changed #
- Cleaned up
pubspec.yamlformatting (removed extra blank line)
1.0.0 #
Changed #
- Removed
FileType.fromName()factory constructor (breaking change) - Made
FileTypeconstructor public (was private) - Added
FileType.copy()constructor for copying FileType instances - Updated all examples and documentation to reflect new API
Added #
- Comprehensive
constructor_usage.dartexample demonstrating FileType constructor patterns - Enhanced documentation for FileType constructor with ExtensionGroupFilter usage
- Example classes showing how to extend FileType (CustomFileType, RestrictedMediaType, FileTypeValidator)
0.1.2 - 2025-11-03 #
Added #
FileType.fromName()factory constructor for creating FileType from category name strings- Support for deserializing FileType from JSON, databases, and string-based formats
- SECURITY.md file with comprehensive security policy and vulnerability reporting guidelines
Documentation #
- Complete inline documentation for
FileType.fromName()method with examples - Updated README with
fromName()usage example - Security policy documentation with best practices
0.1.1 - 2025-11-01 #
Documentation #
- Enhanced README description highlighting key features and use cases
- Complete inline API documentation with comprehensive doc comments:
FileTypeclass with detailed usage examples and method descriptionsExtensionsGroupingclass with categorization explanationExtensionGroupFilterclass with filter logic documentationFileUtilclass with MIME detection examples and magic number reference
- All public APIs now documented with parameters, return values, and code examples
- Updated CONTRIBUTING.md with project-specific guidelines and workflows
- Removed Google CLA references and customized for file_type_plus project
Fixed #
- Resolved 40 linting issues for full compliance with
dart_flutter_team_lints - Removed redundant null arguments in all example files
- Converted to expression function bodies where appropriate (file_manager_demo.dart)
Changed #
- Updated repository references from
file-typetofile_type_plus - Updated git remote origin to match new repository name
0.1.0 - 2025-11-01 #
Added #
- Initial release of the file_type_plus package
- Core
FileTypeclass with support for 7 file type categories:- Image files (jpg, png, gif, bmp, svg, webp, etc.)
- Audio files (mp3, wav, flac, aac, ogg, etc.)
- Video files (mp4, avi, mov, webm, mkv, etc.)
- Document files (pdf, doc, docx, xls, xlsx, ppt, pptx, etc.)
- HTML files (html, htm, xhtml)
- Archive files (zip, rar, tar, gz, 7z, etc.)
- Other (fallback category)
- Multiple detection methods:
FileType.fromExtensionOrMime()- Detect from file extension or MIME typeFileType.fromPath()- Detect from file path or URLFileType.fromBytes()- Detect from byte data using magic numbers
- Special support for streaming video formats:
- ISM (IIS Smooth Streaming Manifest) detection
- HLS (.m3u8) support
- DASH (.mpd) support
- Utility methods:
isAny()- Check if file type matches any in a listisAnyType()- Type checking utilityextensionMap- Access extension mappings for each type
- Comprehensive test suite with 81 tests and 100% line coverage
- Example files demonstrating various use cases:
quick_start.dart- Quick introductionbasic_usage.dart- Basic detection examplespath_detection.dart- Path and URL detectionbytes_detection.dart- Magic number detectionfiltering_files.dart- File filtering and categorizationhtml_filtering.dart- HTML file detectionadvanced_usage.dart- Advanced usage patternsfile_manager_demo.dart- Complete file manager application
- Code coverage infrastructure:
- Coverage script (
tool/coverage.sh) - GitHub Actions CI/CD workflow
- Coverage reporting
- Coverage script (
Fixed #
- Null safety handling in
FileType.fromPath()andFileType.fromBytes() - HTML file detection to properly recognize HTML files (text/html, application/xhtml)
- Linting compliance with
dart_flutter_team_lintsrules
Documentation #
- Comprehensive README with installation and usage examples
- Detailed example documentation in
example/README.md - API documentation with doc comments
- Coverage badge in README
Dependencies #
equatable: ^2.0.7- Value equality for FileType instancesmime: ^2.0.0- MIME type detection and lookups
Development #
dart_flutter_team_lints: ^3.0.0- Linting rulestest: ^1.16.0- Testing framework- Dart SDK: >=3.2.0 <4.0.0
[Unreleased] #
Planned #
- Additional file type categories (fonts, code files, etc.)
- More magic number signatures for byte detection
- Performance optimizations
- Additional MIME type mappings