api_error_parser_plus
A robust and type-safe library for parsing API responses and converting error codes into user-friendly messages with comprehensive error handling and validation.
0.3.0
51 downloads/mo
#4257 most downloaded on pub.dev
What this package is like to depend on
Last release 10 months ago
27 Oct 2025
Ships unpredictably
gaps range from 2 weeks to 2.2 years
Nearly every release is documented
notes for 6 of 6 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
6 releases · first in 2023
3 releases in the last 12 months
see the full history below
Release timeline
6 releases · Jul 2023 to Oct 2025Releases
latest 6-
0.3.027 Oct 2025Release notes
Open source →🎯 Meta Field Support
- NEW: Added optional
metafield support in error messagesErrorMessageEntity.meta- nullableMap<String, dynamic>for dynamic error metadata- Backend can send or omit
metafield with arbitrary data structure - No default empty object -
nullwhen not provided by backend
- ADDED: Type-safe meta accessor methods:
metaInt(String key)- safely get integer valuesmetaDouble(String key)- safely get double valuesmetaStr(String key)- safely get string valuesmetaBool(String key)- safely get boolean valuesmetaMap(String key)- safely get nested map values
- ADDED: Template interpolation with
interpolate(String template)method- Replaces
{key}placeholders with values frommeta - Example:
"Min {min}, max {max}"→"Min 8, max 20"
- Replaces
- UPDATED:
toString()method includesmetafield - TESTED: 15 new test cases covering all meta scenarios
📚 Migration Guide from v0.2.0
- Fully backward compatible - no changes required for existing code
metafield isnullfor responses without metadata- Use new accessor methods for type-safe meta value extraction
- See
example/meta_usage_guide.mdfor detailed usage examples
✅ Use Cases
- Validation errors with min/max constraints
- Product availability with ETA information
- Date format validation with expected/received formats
- Dynamic error parameters for localized messages
🔧 Technical Details
metais parsed only if present and is a valid Map- Invalid meta types are treated as
null(graceful degradation) - No schema validation - application handles meta interpretation
- All existing tests (6) continue to pass
- NEW: Added optional
-
0.2.015 Oct 2025Release notes
Open source →🚀 Major API Format Update
- NEW: Support for simplified API response format
- Success responses no longer require "data" wrapper (direct JSON response)
- Error responses still use "errors" field in root
- Enhanced
fromJsonSafemethod automatically detects response type
- IMPROVED: Type-safe parsing with
ParseResult<T>return types - ADDED: New test resources for different response formats
- UPDATED: Documentation with new API format examples
📚 Migration Guide from v0.1.0
New API Format (Recommended)
- Success responses: Return data directly
{"id": 1, "name": "Tom"} - Error responses: Keep current format
{"errors": [...]} - Library automatically detects response type based on "errors" field presence
Breaking Changes
fromJsonSafenow returnsParseResult<ApiResponseEntity<T>>instead of direct entity- Use
result.dataOrThroworresult.dataOrNullto access parsed data
⚡ Benefits
- Cleaner API responses without unnecessary data wrappers
- Better type safety with ParseResult pattern
- Automatic response type detection
- Backward compatible with legacy format
- NEW: Support for simplified API response format
-
0.1.014 Oct 2025Release notes
Open source →🗑️ Breaking Changes
- REMOVED: Complete pagination logic and related classes
- Removed
ApiResponsePaginationandApiResponsePaginationEntity - Removed
PaginationandPaginationEntityclasses - Removed
ParserResponseWithPaginationEntity - Simplified
ApiParserSuccessResponse(removedpaginationfield)
- Removed
- Simplified: API response handling focuses only on data and errors
📚 Migration Guide from v0.0.4
- Remove any usage of pagination-related classes
ApiParserSuccessResponseno longer haspaginationfield- 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.
- REMOVED: Complete pagination logic and related classes
-
0.0.325 Jul 2023Release notes
Open source →- Added ability to parse lists at the root of JSON responses. Added fromJsonList method to ApiResponseEntity class.
-
0.0.213 Jul 2023Release notes
Open source →- Added hashCode and operator for ParseMessageEntity and ErrorSourceEntity to compare object when testing bloc(integration tests).
-
0.0.110 Jul 2023