api_error_parser_plus 0.1.0 copy "api_error_parser_plus: ^0.1.0" to clipboard
api_error_parser_plus: ^0.1.0 copied to clipboard

A robust and type-safe library for parsing API responses and converting error codes into user-friendly messages with comprehensive error handling and validation.

Changelog #

0.1.0 - 2025-10-14 #

🗑️ Breaking Changes #

  • REMOVED: Complete pagination logic and related classes
    • Removed ApiResponsePagination and ApiResponsePaginationEntity
    • Removed Pagination and PaginationEntity classes
    • Removed ParserResponseWithPaginationEntity
    • Simplified ApiParserSuccessResponse (removed pagination field)
  • Simplified: API response handling focuses only on data and errors

📚 Migration Guide from v0.0.4 #

  • Remove any usage of pagination-related classes
  • ApiParserSuccessResponse no longer has pagination field
  • All pagination handling should be implemented in application layer

⚠️ Why Removed? #

Pagination logic was removed to keep the library focused on its core responsibility: error parsing and message handling. Pagination is better handled at the application level or in dedicated data layer components.

0.0.4 - 2025-10-14 #

🚀 Major Enhancements #

Added

  • ErrorTarget enum: Strong type safety for error targets (ErrorTarget.field, ErrorTarget.common)
  • ParseResult: Comprehensive result handling for safer parsing operations
  • ApiParserConfig: Flexible configuration system with predefined environments
    • ApiParserConfig.production: Minimal logging, graceful error handling
    • ApiParserConfig.debug: Detailed logging for development
    • ApiParserConfig.testing: Strict validation for tests
  • Safe parsing methods: fromJsonSafe() variants with detailed error reporting
  • Enhanced validation: Automatic validation of error structure and required fields
  • Error analysis tools:
    • getUnknownErrorCodes(): Identify unmapped error codes
    • isValidErrorMessage(): Validate error message structure

Enhanced

  • Robust error handling: Better exception handling and error reporting
  • Type safety: Eliminated magic strings and improved type checking
  • Backward compatibility: All existing APIs continue to work
  • Documentation: Comprehensive README with migration guide and examples
  • Test coverage: Enhanced test suite with new configuration options

Fixed

  • JSON parsing errors: Proper validation and error reporting for malformed data
  • Null safety: Better handling of null and empty values
  • Field validation: Strict validation for field target requirements
  • Memory efficiency: Optimized error processing for large error lists

🔧 Breaking Changes #

  • ParserMessageEntity.target type changed from String to ErrorTarget
  • Direct string comparisons with error targets should be replaced with enum usage

📚 Migration Guide #

  1. Replace string comparisons: error.target == "field"error.target == ErrorTarget.field
  2. Add configuration parameter to ApiParser constructor (optional)
  3. Consider migrating to fromJsonSafe methods for better error handling

0.0.3 Previous Version #

  • Added ability to parse lists at the root of JSON responses. Added fromJsonList method to ApiResponseEntity class.

0.0.2 Previous Version #

  • Added hashCode and operator for ParseMessageEntity and ErrorSourceEntity to compare object when testing bloc(integration tests).

0.0.1 Initial Version #

  • Initial version with basic API error parsing functionality
3
likes
0
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

A robust and type-safe library for parsing API responses and converting error codes into user-friendly messages with comprehensive error handling and validation.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on api_error_parser_plus