Skip to content
This repository was archived by the owner on Aug 4, 2026. It is now read-only.

feat!: 6.0.0 Major Refactoring - Complete Breaking Changes - #510

Merged
hyochan merged 41 commits into
mainfrom
feat/6.0.0-major-refactoring
Aug 3, 2025
Merged

feat!: 6.0.0 Major Refactoring - Complete Breaking Changes#510
hyochan merged 41 commits into
mainfrom
feat/6.0.0-major-refactoring

Conversation

@hyochan

@hyochan hyochan commented Jul 24, 2025

Copy link
Copy Markdown
Owner

🚀 Summary

Major refactoring for flutter_inapp_purchase v6.0.0 with complete breaking changes to improve type safety, code organization, and developer experience.

💥 BREAKING CHANGES

File Structure

  • Moved all enums from types.dart to new enums.dart file
  • Renamed Store.dart to enums.dart for consistency
  • Split module-specific code into separate files:
    • modules/android.dart for Android-specific functionality
    • modules/ios.dart for iOS-specific functionality
  • Created dedicated type files:
    • types/iap_android_types.dart
    • types/iap_ios_types.dart

Type Safety Improvements

  • Fixed all List<dynamic>? warnings with explicit type annotations
  • Added explicit Future<dynamic> return types where applicable
  • Fixed all type inference issues with explicit parameter types
  • Improved null safety throughout the codebase

Removed Deprecated APIs

  • Removed unused _finishTransactionIOSOld method
  • Cleaned up deprecated methods scheduled for removal in v6.0.0

Error Handling

  • Created new utils/error_mapping.dart for centralized error handling
  • Improved error type definitions and mapping

✨ New Features

  • Added use_iap.dart hook for Flutter Hooks integration
  • Better separation of concerns with module-specific files
  • Improved type definitions for Android and iOS platforms

📝 Migration Guide

Import Changes

// Before
import 'package:flutter_inapp_purchase/Store.dart';
import 'package:flutter_inapp_purchase/types.dart';

// After
import 'package:flutter_inapp_purchase/enums.dart';
import 'package:flutter_inapp_purchase/types.dart';

Enum Usage

All enums are now imported from enums.dart. The types.dart file exports enums.dart for backward compatibility, but direct imports are recommended.

Platform-Specific Code

// Android-specific
import 'package:flutter_inapp_purchase/modules/android.dart';

// iOS-specific
import 'package:flutter_inapp_purchase/modules/ios.dart';

🧪 Test Plan

  • All existing tests pass
  • Type checking passes without warnings
  • Example app runs correctly on both platforms
  • Migration from v5.x works as documented

📊 Impact

This is a major version bump (v6.0.0) with extensive breaking changes. All users will need to update their code when upgrading.

Closes #505 #507 #503 #501 #500 #496 #495 #494 #491 #482

@hyochan hyochan changed the title feat\!: 6.0.0 Major Refactoring - Complete Breaking Changes feat!: 6.0.0 Major Refactoring - Complete Breaking Changes Jul 24, 2025
@FelixYew

Copy link
Copy Markdown

This version 6.0.0 purchaseUpdatedListener for iOS doesn't work. When requestPurchase on iOS the result doesn't call purchaseUpdatedListener.

@FelixYew

Copy link
Copy Markdown

Another error for finishTransaction on Android calling 'consumeProduct' and 'acknowledgePurchase' passing token key should be 'purchaseToken' instead of 'token'.

hyochan added 20 commits August 1, 2025 19:29
BREAKING CHANGE: Complete refactoring for v6.0.0
- Move all enums from types.dart to enums.dart
- Fix all type inference and strict type warnings
- Remove deprecated methods
- Improve type safety throughout the codebase
- Reorganize file structure for better maintainability
- Update FlutterInappPurchase.channel to FlutterInappPurchase.instance.channel
- Fix all channel.setMethodCallHandler references in tests
- Resolve static_access_to_instance_member errors
- Update all ErrorCode enum values from SCREAMING_SNAKE_CASE to lowerCamelCase
- Update all references throughout the codebase
- Fix constant_identifier_names lint warnings
- Update error mapping utilities and tests
- Replace double quotes with single quotes where appropriate
- Remove unnecessary 'this.' qualifiers
- Fix parameter ordering (required parameters before optional)
- Improve code consistency
- Change PeriodUnitIOS enum values to lowerCamelCase
- Add library directive to error_mapping.dart
- Fix dangling library doc comment warning
- Format lib/flutter_inapp_purchase.dart
- Format lib/modules/android.dart
- Format lib/modules/ios.dart
- Format lib/types.dart
- Ensure consistent code formatting
- Update all example screens to use the new API
- Remove duplicate use_iap.dart from example (now using lib version)
- Fix imports and update code to match new structure
- Clean up example app implementation
- Add migration guide for ErrorCode enum changes
- Add migration guide for PeriodUnitIOS enum changes
- Add error handling examples with new enum values
- Update CHANGELOG.md with breaking changes
- Add mixin architecture notes
- Move channel initialization to setUpAll to ensure it runs within test zone
- Fix 'There is no current invoker' error in tests
- All tests now pass successfully
- Update community section with Stack Overflow, GitHub Issues, and Slack
- Change API Reference link to /docs/api/
- Remove Basic Setup link from footer
- Update copyright to 'Copyright © 2025 hyochan.'
- Remove Common Migration Issues section from migration guide
- Fix sidebar configuration for examples/subscription-store
Promotional Offers are iOS-only feature, not available on Android.
Updated table to reflect accurate platform capabilities.
Add detailed API documentation structure:
- Core methods and functions
- Error codes and handling
- Event listeners and streams
- Type definitions and interfaces
- useIAP hook documentation
- Examples category configuration

These provide complete reference documentation for developers.
- Enhance basic store example with comprehensive implementation
- Update FAQ with common questions and solutions
- Improve lifecycle guide with detailed state management
- Add offer code redemption guide for iOS promotional offers
- Update purchases guide with best practices
- Enhance troubleshooting guide with common issues

These updates provide better developer guidance and examples.
- Update homepage content and styling for flutter_inapp_purchase
- Add version configuration for proper versioning support
- Improve landing page user experience

These changes enhance the documentation site's presentation.
hyochan and others added 18 commits August 1, 2025 19:53
Add comprehensive debug screen for testing purchase functionality:
- View available products and pricing
- Test purchase flows and error handling
- Debug purchase states and transactions
- Monitor connection status

This helps developers test and debug in-app purchase implementations.
Update iOS deployment target to 15.0 to support StoreKit 2 features
and ensure compatibility with latest iOS capabilities for in-app purchases.
Update homepage navigation links to match current documentation structure:
- Guides: /guides/basic-setup → /guides/purchases
- API Reference: /api/flutter-inapp-purchase → /api/
- Examples: /examples/basic-purchase → /examples/basic-store

These links now correctly point to existing documentation pages.
Add npm start command to allowed bash commands for
easier documentation development workflow.
Remove outdated "dooboolab" comment from gitignore.
Update all navigation links in homepage cards to include proper /docs prefix:
- Getting Started: /getting-started/installation → /docs/getting-started/installation
- Guides: /guides/purchases → /docs/guides/purchases
- API Reference: /api/ → /docs/api/
- Examples: /examples/basic-store → /docs/examples/basic-store
- Bottom CTA: /getting-started/installation → /docs/getting-started/installation

These links now correctly navigate to the documentation pages.
- Moved Android source files to new package structure
- Updated package declarations in all Kotlin files
- Updated import statements across the codebase
- Modified Android manifest and build.gradle
- Updated pubspec.yaml plugin configuration
- Updated all documentation references
- Changed package namespace throughout the project

This aligns the package naming with the current maintainer domain.
Fix dart format issues detected in CI:
- Format debug_purchases_screen.dart
- Format home_screen.dart
- Apply consistent code formatting across all Dart files

This resolves the CI formatting check failures.
- Streamline README to essential information only
- Add prominent link to documentation site (flutter-inapp-purchase.hyo.dev)
- Include quick start example and key features
- Redirect detailed documentation to the dedicated site
- Keep only essential setup and community information
- Update ProGuard rules to use new package name (dev.hyochan)

This makes the README more focused while providing comprehensive
documentation through the dedicated site.
- Move Android source files to new package structure (dev.hyo.flutterinapppurchase)
- Update package declarations in all Kotlin files
- Update Android manifest and build.gradle configurations
- Update pubspec.yaml plugin configuration
- Update all documentation references
- Update ProGuard rules for new package name

This shortens the package name for better consistency with domain.
- Rename docs/ to doc/ to follow pub.dev layout convention
- Add CHANGELOG.md entry for v6.0.0-rc.1 release candidate
- Document breaking changes and migration guide
- Include package name changes and new features

This resolves pub validation warnings for publication.
Exclude doc/, example/, test/, and development files from pub.dev package
to reduce package size and focus on core plugin functionality.
- Fix iOS purchaseUpdatedListener not triggering on direct purchases
- Fix Android finishTransaction to use 'purchaseToken' instead of 'token' parameter
- Use deepLinkToSubscriptionsAndroid() instead of throwing NOT_IMPLEMENTED error
- Allows Android users to manage subscriptions through Play Store
@hyochan
hyochan force-pushed the feat/6.0.0-major-refactoring branch from da29bc1 to 672e874 Compare August 1, 2025 18:02
@hyochan

hyochan commented Aug 1, 2025

Copy link
Copy Markdown
Owner Author

@FelixYew Thanks for testing 6.0.0-rc.1 and sharing the report! Could you please try 6.0.0-rc.2? I’ve just published the fixes.

hyochan added 2 commits August 2, 2025 12:02
## Summary
- Add Swift Package Manager (SPM) support alongside existing CocoaPods
support
- Create Package.swift configuration for SPM
- Maintain backward compatibility with CocoaPods

## Changes
- Added `Package.swift` file with proper SPM configuration
- Updated `pubspec.yaml` to include `sharedDarwinSource: true` for iOS
platform
- Created `darwin/` directory structure for shared iOS/macOS code
- Modified podspec to avoid file duplication issues

## Context
As mentioned in the issue #506, Flutter is moving towards Swift Package
Manager support since CocoaPods is transitioning to read-only mode. This
PR adds SPM support while maintaining full backward compatibility with
existing CocoaPods users.

## Test plan
- [x] Tested with CocoaPods - pod install works correctly
- [x] Verified no duplicate file errors during build
- [ ] Test with Swift Package Manager enabled projects
- [ ] Verify example app builds and runs correctly

Closes #506
@hyochan
hyochan merged commit ac9fa29 into main Aug 3, 2025
1 check passed
@hyochan
hyochan deleted the feat/6.0.0-major-refactoring branch August 3, 2025 17:26
@FelixYew

FelixYew commented Aug 4, 2025

Copy link
Copy Markdown

@hyochan Thanks for the fixes. Is working now.

@doublev2906

doublev2906 commented Aug 5, 2025

Copy link
Copy Markdown

Hi @hyochan, i have just updated to version [6.0.0-rc.3] and i take this eror when run flutter run:
Swift Compiler Error (Xcode): Value of type 'AppTransaction' has no member 'appTransactionID' /Users/pancake/.pub-cache/hosted/pub.dev/flutter_inapp_purchase-6.0.0-rc.3/darwin/Classes/FlutterInappPurchasePlugin.swift:618:72
Can you help me fix this. If you need more information to check it please inform me.

@hyochan

hyochan commented Aug 5, 2025

Copy link
Copy Markdown
Owner Author

@doublev2906 Could you kindly share your Xcode version and also check the doc in expo-iap? It isn't in flutter doc but this is same issue as in https://expo-iap.hyo.dev/docs/guides/faq#build-error-apptransactionid-property-not-found.

@doublev2906

Copy link
Copy Markdown

@hyochan I am used xcode version 16.2. Sorry about a mistake. Thank you so much.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] iOS storekit2 support

3 participants