mayr_fake_api 2.0.0 
mayr_fake_api: ^2.0.0 copied to clipboard
A pure Dart package that intercepts API calls and returns fake JSON responses from local files during development.
2.0.0 #
🎉 Major Release - V2.0.0
🚀 Breaking Changes #
- 
Flat JSON Structure: New dot-notation file naming system (e.g.,
user.profile.get.jsoninstead ofuser/profile/get.json)- Simplifies asset management - only need to add 
assets/api/once inpubspec.yaml - No more multiple directory listings required
 - Backwards compatible with v1.x nested structure for seamless migration
 
 - Simplifies asset management - only need to add 
 - 
JSON Structure Update: Changed from
datatobodyfor claritybodyrepresents the actual HTTP response bodystatusCoderepresents the HTTP status code- V1.x Compatibility: Files using 
dataare still supported for backward compatibility 
 
✨ New Features #
- 
Debug Mode: Added
debugparameter toMayrFakeApi.init()for console logging- Logs request interception, file loading attempts, and response status
 - Helps developers debug API simulation issues
 - Example: 
await MayrFakeApi.init(debug: true, ...) 
 - 
Headers and Cookies Support: Added optional
headersandcookiesfields to JSON responses- Simulate response headers (e.g., 
Content-Type, custom headers) - Simulate response cookies (e.g., 
session_id,refresh_token) - Both fields are optional and can be omitted if not needed
 
 - Simulate response headers (e.g., 
 
🏢 Organizational Changes #
- Repository transferred to MayR-Labs organization
 - Updated LICENSE to reflect MayR Labs (https://mayrlabs.com)
 - Added company motto: "Building the future, one line at a time..."
 - Updated all URLs to 
https://github.com/MayR-Labs/mayr_dart_fake_api 
📦 Migration Guide from v1.x to v2.0 #
Option 1: Use Flat Structure (Recommended)
- 
Convert your nested JSON files to flat structure:
assets/api/user/profile/get.json→assets/api/user.profile.get.jsonassets/api/products/details/get.json→assets/api/products.details.get.jsonassets/api/user/-/profile/get.json→assets/api/user.-.profile.get.json
 - 
Update JSON structure from
datatobody:{ "statusCode": 200, "body": { ... }, "headers": { ... }, // Optional "cookies": { ... } // Optional } - 
Update your
pubspec.yaml:flutter: assets: - assets/api/ # Just one line! 
Option 2: Keep Nested Structure
- No changes required! V2.0 maintains full backwards compatibility with v1.x nested structure
 - Files using 
datainstead ofbodycontinue to work - The package automatically tries flat structure first, then falls back to nested structure
 
🔧 Technical Changes #
- Added flat file resolution with wildcard support
 - Enhanced interceptor with debug logging throughout request lifecycle
 - Improved error messages and debugging capabilities
 
1.0.0 #
- 🎉 Initial stable release
 - ✨ Intercepts Dio HTTP requests and returns fake JSON responses from local assets
 - 📁 Supports flexible directory structure for organizing fake API responses
 - 🔄 Supports all HTTP methods (GET, POST, PUT, DELETE, etc.)
 - 🌟 Dynamic path support with wildcards (e.g., 
/user/-/profile) - 🔧 Placeholder replacement in JSON responses (
$1,$2,$timestamp) - 🎲 Built-in placeholder support: 
$uuidand$ulid - 🔧 Custom placeholder functionality for user-defined dynamic values
 - 📭 Automatic 204 No Content response for empty JSON files
 - ⚠️ Error simulation with 
error.jsonfiles - 🚫 Customizable 404 not found responses
 - ⏱️ Configurable network delay simulation
 - 🎛️ Enable/disable toggle for development/production
 - 📚 Comprehensive documentation and examples
 - ✅ Full test coverage
 - 🐛 Fixed test suite bugs (corrected URL paths and data access patterns)
 - 📦 Added 
uuidandfakerpackage dependencies 
0.0.1 #
- Initial release