From e12ec8ec40e862edb0abf1ec1f206ef508f46d38 Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Wed, 15 Apr 2026 11:18:08 +0900 Subject: [PATCH 1/6] Reproduce breaking change bug in UIScene for v3.38.x --- example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Flutter/Flutter.podspec | 2 +- .../Flutter/ephemeral/flutter_lldb_helper.py | 32 +++++++++++++++++++ .../ios/Flutter/ephemeral/flutter_lldbinit | 5 +++ example/ios/Podfile | 2 +- example/ios/Podfile.lock | 10 +++--- .../xcshareddata/xcschemes/Runner.xcscheme | 2 ++ example/ios/Runner/AppDelegate.swift | 7 ++-- example/ios/Runner/Info.plist | 21 ++++++++++++ example/lib/main.dart | 3 +- example/pubspec.lock | 30 ++++++++--------- 11 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 example/ios/Flutter/ephemeral/flutter_lldb_helper.py create mode 100644 example/ios/Flutter/ephemeral/flutter_lldbinit diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 8c6e561..d57061d 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 98e1633..3aed58d 100644 --- a/example/ios/Flutter/Flutter.podspec +++ b/example/ios/Flutter/Flutter.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.license = { :type => 'BSD' } s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '12.0' + s.ios.deployment_target = '13.0' # Framework linking is handled by Flutter tooling, not CocoaPods. # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. s.vendored_frameworks = 'path/to/nothing' diff --git a/example/ios/Flutter/ephemeral/flutter_lldb_helper.py b/example/ios/Flutter/ephemeral/flutter_lldb_helper.py new file mode 100644 index 0000000..a88caf9 --- /dev/null +++ b/example/ios/Flutter/ephemeral/flutter_lldb_helper.py @@ -0,0 +1,32 @@ +# +# Generated file, do not edit. +# + +import lldb + +def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict): + """Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages.""" + base = frame.register["x0"].GetValueAsAddress() + page_len = frame.register["x1"].GetValueAsUnsigned() + + # Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the + # first page to see if handled it correctly. This makes diagnosing + # misconfiguration (e.g. missing breakpoint) easier. + data = bytearray(page_len) + data[0:8] = b'IHELPED!' + + error = lldb.SBError() + frame.GetThread().GetProcess().WriteMemory(base, data, error) + if not error.Success(): + print(f'Failed to write into {base}[+{page_len}]', error) + return + +def __lldb_init_module(debugger: lldb.SBDebugger, _): + target = debugger.GetDummyTarget() + # Caveat: must use BreakpointCreateByRegEx here and not + # BreakpointCreateByName. For some reasons callback function does not + # get carried over from dummy target for the later. + bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$") + bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__)) + bp.SetAutoContinue(True) + print("-- LLDB integration loaded --") diff --git a/example/ios/Flutter/ephemeral/flutter_lldbinit b/example/ios/Flutter/ephemeral/flutter_lldbinit new file mode 100644 index 0000000..e3ba6fb --- /dev/null +++ b/example/ios/Flutter/ephemeral/flutter_lldbinit @@ -0,0 +1,5 @@ +# +# Generated file, do not edit. +# + +command script import --relative-to-command-file flutter_lldb_helper.py diff --git a/example/ios/Podfile b/example/ios/Podfile index 2c068c4..10f3c9b 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '12.0' +platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 15efdab..65ccd17 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -23,7 +23,7 @@ PODS: - GoogleUtilities/Privacy - integration_test (0.0.1): - Flutter - - payjp_flutter (0.7.5): + - payjp_flutter (0.7.7): - Flutter - GoogleUtilities/AppDelegateSwizzler (~> 8) - PAYJPFlutterCore (~> 2.2.1) @@ -56,13 +56,13 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/payjp_flutter/ios" SPEC CHECKSUMS: - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d - integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 - payjp_flutter: 5cf15ae9f966154eb37d036e9960c18f16da02a8 + integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e + payjp_flutter: 2787fdc0395d0e7eed14b0d94073e662cc11381c PAYJPFlutterCore: 23ef3f4e66075b0069b9dbca495b1fa488ee8f5d PhoneNumberKit: a74155066daa6450475f6a029068eb919fb00d5d -PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 +PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b COCOAPODS: 1.16.2 diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 4f74653..fc5ae03 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" shouldUseLaunchSchemeArgsEnv = "YES"> @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 793cbed..5742eac 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -2,12 +2,15 @@ import UIKit import Flutter @main -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index cbd7f5f..a2cb74f 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -60,5 +60,26 @@ UIApplicationSupportsIndirectInputEvents + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneDelegateClassName + FlutterSceneDelegate + UISceneConfigurationName + flutter + UISceneStoryboardFile + Main + + + + diff --git a/example/lib/main.dart b/example/lib/main.dart index 605862b..dc6f45a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -126,7 +126,8 @@ class HomeScreenState extends State { onCardFormCompletedCallback: _onCardFormCompleted, onCardFormProducedTokenCallback: _onCardFormProducedToken, cardFormType: formType, - extraAttributes: extraAttributes); + extraAttributes: extraAttributes, + useThreeDSecure: true); } void _onStartApplePay() async { diff --git a/example/pubspec.lock b/example/pubspec.lock index 2024c3e..c3ab825 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" file: dependency: transitive description: @@ -134,26 +134,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.8" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" matcher: dependency: transitive description: @@ -174,10 +174,10 @@ packages: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" path: dependency: transitive description: @@ -266,10 +266,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.7" typed_data: dependency: transitive description: @@ -282,10 +282,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -311,5 +311,5 @@ packages: source: hosted version: "3.0.4" sdks: - dart: ">=3.7.0-0 <4.0.0" + dart: ">=3.8.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" From c99459d54e35ffc1b88532bcba1b76a7e71167a4 Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Wed, 15 Apr 2026 12:29:36 +0900 Subject: [PATCH 2/6] Add support for scene:openURLContexts: --- ios/Classes/SwiftPayjpFlutterPlugin.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ios/Classes/SwiftPayjpFlutterPlugin.swift b/ios/Classes/SwiftPayjpFlutterPlugin.swift index f03937e..841e894 100644 --- a/ios/Classes/SwiftPayjpFlutterPlugin.swift +++ b/ios/Classes/SwiftPayjpFlutterPlugin.swift @@ -7,6 +7,7 @@ public class SwiftPayjpFlutterPlugin: NSObject, FlutterPlugin { let channel = FlutterMethodChannel(name: "payjp", binaryMessenger: registrar.messenger()) let instance = SwiftPayjpFlutterPlugin(channel: channel) registrar.addMethodCallDelegate(instance, channel: channel) + registrar.addSceneDelegate(instance) } private let channel: FlutterMethodChannel private let cardFormModule: CardFormModuleType @@ -159,3 +160,16 @@ public class SwiftPayjpFlutterPlugin: NSObject, FlutterPlugin { return UIColor(red: r, green: g, blue: b, alpha: a) } } + +extension SwiftPayjpFlutterPlugin: FlutterSceneLifeCycleDelegate { + @available(iOS 13.0, *) + public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { + var handled = false + for context in URLContexts { + if ThreeDSecureProcessHandler.shared.completeThreeDSecureProcess(url: context.url) { + handled = true + } + } + return handled + } +} From 781a77f64d4069f4f9a261a792ee1126320af90b Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Wed, 15 Apr 2026 12:36:30 +0900 Subject: [PATCH 3/6] chore: Clean up code --- example/.gitignore | 1 + example/ios/Flutter/Flutter.podspec | 2 +- .../Flutter/ephemeral/flutter_lldb_helper.py | 32 ------------------- .../ios/Flutter/ephemeral/flutter_lldbinit | 5 --- ios/Classes/SwiftPayjpFlutterPlugin.swift | 3 +- 5 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 example/ios/Flutter/ephemeral/flutter_lldb_helper.py delete mode 100644 example/ios/Flutter/ephemeral/flutter_lldbinit diff --git a/example/.gitignore b/example/.gitignore index 1398e16..704b71a 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -62,6 +62,7 @@ **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ **/ios/Flutter/flutter_export_environment.sh +**/ios/Flutter/ephemeral/ **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 3aed58d..98e1633 100644 --- a/example/ios/Flutter/Flutter.podspec +++ b/example/ios/Flutter/Flutter.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.license = { :type => 'BSD' } s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '13.0' + s.ios.deployment_target = '12.0' # Framework linking is handled by Flutter tooling, not CocoaPods. # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. s.vendored_frameworks = 'path/to/nothing' diff --git a/example/ios/Flutter/ephemeral/flutter_lldb_helper.py b/example/ios/Flutter/ephemeral/flutter_lldb_helper.py deleted file mode 100644 index a88caf9..0000000 --- a/example/ios/Flutter/ephemeral/flutter_lldb_helper.py +++ /dev/null @@ -1,32 +0,0 @@ -# -# Generated file, do not edit. -# - -import lldb - -def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict): - """Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages.""" - base = frame.register["x0"].GetValueAsAddress() - page_len = frame.register["x1"].GetValueAsUnsigned() - - # Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the - # first page to see if handled it correctly. This makes diagnosing - # misconfiguration (e.g. missing breakpoint) easier. - data = bytearray(page_len) - data[0:8] = b'IHELPED!' - - error = lldb.SBError() - frame.GetThread().GetProcess().WriteMemory(base, data, error) - if not error.Success(): - print(f'Failed to write into {base}[+{page_len}]', error) - return - -def __lldb_init_module(debugger: lldb.SBDebugger, _): - target = debugger.GetDummyTarget() - # Caveat: must use BreakpointCreateByRegEx here and not - # BreakpointCreateByName. For some reasons callback function does not - # get carried over from dummy target for the later. - bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$") - bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__)) - bp.SetAutoContinue(True) - print("-- LLDB integration loaded --") diff --git a/example/ios/Flutter/ephemeral/flutter_lldbinit b/example/ios/Flutter/ephemeral/flutter_lldbinit deleted file mode 100644 index e3ba6fb..0000000 --- a/example/ios/Flutter/ephemeral/flutter_lldbinit +++ /dev/null @@ -1,5 +0,0 @@ -# -# Generated file, do not edit. -# - -command script import --relative-to-command-file flutter_lldb_helper.py diff --git a/ios/Classes/SwiftPayjpFlutterPlugin.swift b/ios/Classes/SwiftPayjpFlutterPlugin.swift index 841e894..ca574b6 100644 --- a/ios/Classes/SwiftPayjpFlutterPlugin.swift +++ b/ios/Classes/SwiftPayjpFlutterPlugin.swift @@ -161,13 +161,14 @@ public class SwiftPayjpFlutterPlugin: NSObject, FlutterPlugin { } } +@available(iOS 13.0, *) extension SwiftPayjpFlutterPlugin: FlutterSceneLifeCycleDelegate { - @available(iOS 13.0, *) public func scene(_ scene: UIScene, openURLContexts URLContexts: Set) -> Bool { var handled = false for context in URLContexts { if ThreeDSecureProcessHandler.shared.completeThreeDSecureProcess(url: context.url) { handled = true + break } } return handled From 78eb8d7762b333c162fde24edade1fe6928b1a2e Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Fri, 17 Apr 2026 19:53:02 +0900 Subject: [PATCH 4/6] Update flutter version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 28e0af3..7da93d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ repository: https://github.com/payjp/payjp-flutter-plugin environment: sdk: ">=3.0.0 <4.0.0" - flutter: ">=1.12.0" + flutter: ">=3.38.0" dependencies: flutter: From 8acdf8f84fc109ee56a9f5acd70df7e86a052fbf Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Fri, 17 Apr 2026 20:41:01 +0900 Subject: [PATCH 5/6] Update dart. example verions --- example/android/app/build.gradle | 1 + example/android/settings.gradle | 2 +- example/ios/Flutter/Flutter.podspec | 2 +- example/pubspec.lock | 4 +-- example/pubspec.yaml | 2 +- pubspec.lock | 53 +++++++++++------------------ pubspec.yaml | 4 +-- 7 files changed, 28 insertions(+), 40 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ac5ef62..b2d77a7 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -30,6 +30,7 @@ plugins { android { namespace = "jp.pay.flutter.example" compileSdk = flutter.compileSdkVersion + ndkVersion = "28.2.13676358" compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 0de876d..7467354 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -42,7 +42,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version '8.6.0' apply false - id "org.jetbrains.kotlin.android" version "1.8.22" apply false + id "org.jetbrains.kotlin.android" version "2.1.0" apply false } include ":app" diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec index 98e1633..3aed58d 100644 --- a/example/ios/Flutter/Flutter.podspec +++ b/example/ios/Flutter/Flutter.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.license = { :type => 'BSD' } s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '12.0' + s.ios.deployment_target = '13.0' # Framework linking is handled by Flutter tooling, not CocoaPods. # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. s.vendored_frameworks = 'path/to/nothing' diff --git a/example/pubspec.lock b/example/pubspec.lock index c3ab825..167b345 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -311,5 +311,5 @@ packages: source: hosted version: "3.0.4" sdks: - dart: ">=3.8.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.10.0 <4.0.0" + flutter: ">=3.38.1" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 4590d7e..392d198 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: Demonstrates how to use the payjp_flutter plugin. publish_to: 'none' environment: - sdk: '>=2.15.0 <4.0.0' + sdk: '>=3.10.0 <4.0.0' dependencies: flutter: diff --git a/pubspec.lock b/pubspec.lock index 63a954f..9354ea6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,23 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab" + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" url: "https://pub.dev" source: hosted - version: "76.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.3" + version: "67.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e" + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" url: "https://pub.dev" source: hosted - version: "6.11.0" + version: "6.4.1" args: dependency: transitive description: @@ -186,10 +181,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" file: dependency: transitive description: @@ -284,26 +279,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" url: "https://pub.dev" source: hosted - version: "10.0.8" + version: "11.0.2" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" url: "https://pub.dev" source: hosted - version: "3.0.9" + version: "3.0.10" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" logging: dependency: transitive description: @@ -312,14 +307,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - macros: - dependency: transitive - description: - name: macros - sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656" - url: "https://pub.dev" - source: hosted - version: "0.1.3-main.0" matcher: dependency: transitive description: @@ -340,10 +327,10 @@ packages: dependency: "direct main" description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mime: dependency: transitive description: @@ -473,10 +460,10 @@ packages: dependency: transitive description: name: test_api - sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.4" + version: "0.7.7" timing: dependency: transitive description: @@ -497,10 +484,10 @@ packages: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.0" vm_service: dependency: transitive description: @@ -550,5 +537,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.7.0-0 <4.0.0" - flutter: ">=3.18.0-18.0.pre.54" + dart: ">=3.10.0 <4.0.0" + flutter: ">=3.38.1" diff --git a/pubspec.yaml b/pubspec.yaml index 7da93d6..353ec5a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,8 +5,8 @@ homepage: https://github.com/payjp/payjp-flutter-plugin repository: https://github.com/payjp/payjp-flutter-plugin environment: - sdk: ">=3.0.0 <4.0.0" - flutter: ">=3.38.0" + sdk: ">=3.10.0 <4.0.0" + flutter: ">=3.38.1" dependencies: flutter: From bb80d552ea0db5b76e0a2059f08c7ed4d2e9439a Mon Sep 17 00:00:00 2001 From: bu-tokumitsu Date: Fri, 17 Apr 2026 20:47:04 +0900 Subject: [PATCH 6/6] Modify dart format --- example/lib/main.dart | 237 ++++++++-------- example/lib/sample_backend_service.dart | 3 +- example/lib/widgets/alert_dialog.dart | 63 ++--- lib/src/card.dart | 354 ++++++++++++++++++------ lib/src/card.g.dart | 96 +++---- lib/src/card_brand.g.dart | 19 +- lib/src/error_info.g.dart | 96 +++++-- lib/src/payjp.dart | 129 +++++---- lib/src/serializers.g.dart | 13 +- lib/src/token.dart | 96 +++++-- lib/src/token.g.dart | 53 ++-- 11 files changed, 729 insertions(+), 430 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index dc6f45a..f4900ad 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,9 +20,7 @@ const String payjpPublicKey = "pk_test_0383a1b8f91e8a6e3ea0e2a9"; const String appleMerchantId = 'merchant.jp.pay.example2'; // TODO: REPLACE WITH YOUR APPLE MERCHANT ID -void main() => runApp(MaterialApp( - home: HomeScreen(), - )); +void main() => runApp(MaterialApp(home: HomeScreen())); class HomeScreen extends StatefulWidget { @override @@ -43,10 +41,13 @@ class HomeScreenState extends State { Future _initPayjp() async { await Payjp.init( - publicKey: payjpPublicKey, - debugEnabled: true, - threeDSecureRedirect: PayjpThreeDSecureRedirect( - url: 'jp.pay.example://tds/finish', key: 'mobileapp')); + publicKey: payjpPublicKey, + debugEnabled: true, + threeDSecureRedirect: PayjpThreeDSecureRedirect( + url: 'jp.pay.example://tds/finish', + key: 'mobileapp', + ), + ); var isApplePayAvailable = false; if (Platform.isIOS) { await Payjp.setIOSCardFormStyle( @@ -65,69 +66,77 @@ class HomeScreenState extends State { void _showSheetToStartCardForm({required CardFormType formType}) { showModalBottomSheet( - context: context, - builder: (context) => ListView( - shrinkWrap: true, - children: [ - ListTile( - title: Text('Email And Phone'), - onTap: () { - Navigator.pop(context); - _onStartCardForm(formType: formType, extraAttributes: [ - ExtraAttributeEmail(), - ExtraAttributePhone() - ]); - }, - ), - ListTile( - title: Text('Email'), - onTap: () { - Navigator.pop(context); - _onStartCardForm( - formType: formType, - extraAttributes: [ExtraAttributeEmail()]); - }, - ), - ListTile( - title: Text('Phone'), - onTap: () { - Navigator.pop(context); - _onStartCardForm( - formType: formType, - extraAttributes: [ExtraAttributePhone()]); - }, - ), - ListTile( - title: Text('Email And Phone (Preset)'), - onTap: () { - Navigator.pop(context); - _onStartCardForm(formType: formType, extraAttributes: [ - ExtraAttributeEmail("test@example.com"), - ExtraAttributePhone("JP", "09012345678") - ]); - }, - ), - ListTile( - title: Text('None'), - onTap: () { - Navigator.pop(context); - _onStartCardForm(formType: formType, extraAttributes: []); - }, - ), - ], - )); + context: context, + builder: (context) => ListView( + shrinkWrap: true, + children: [ + ListTile( + title: Text('Email And Phone'), + onTap: () { + Navigator.pop(context); + _onStartCardForm( + formType: formType, + extraAttributes: [ExtraAttributeEmail(), ExtraAttributePhone()], + ); + }, + ), + ListTile( + title: Text('Email'), + onTap: () { + Navigator.pop(context); + _onStartCardForm( + formType: formType, + extraAttributes: [ExtraAttributeEmail()], + ); + }, + ), + ListTile( + title: Text('Phone'), + onTap: () { + Navigator.pop(context); + _onStartCardForm( + formType: formType, + extraAttributes: [ExtraAttributePhone()], + ); + }, + ), + ListTile( + title: Text('Email And Phone (Preset)'), + onTap: () { + Navigator.pop(context); + _onStartCardForm( + formType: formType, + extraAttributes: [ + ExtraAttributeEmail("test@example.com"), + ExtraAttributePhone("JP", "09012345678"), + ], + ); + }, + ), + ListTile( + title: Text('None'), + onTap: () { + Navigator.pop(context); + _onStartCardForm(formType: formType, extraAttributes: []); + }, + ), + ], + ), + ); } - void _onStartCardForm( - {required CardFormType formType, - required List extraAttributes}) async { + void _onStartCardForm({ + required CardFormType formType, + required List extraAttributes, + }) async { await Payjp.startCardForm( - onCardFormCanceledCallback: _onCardFormCanceled, - onCardFormCompletedCallback: _onCardFormCompleted, - onCardFormProducedTokenCallback: _onCardFormProducedToken, - cardFormType: formType, - extraAttributes: extraAttributes, - useThreeDSecure: true); + onCardFormCanceledCallback: _onCardFormCanceled, + onCardFormCompletedCallback: _onCardFormCompleted, + onCardFormProducedTokenCallback: _onCardFormProducedToken, + cardFormType: formType, + extraAttributes: extraAttributes, + useThreeDSecure: true, + ); } void _onStartApplePay() async { @@ -151,9 +160,10 @@ class HomeScreenState extends State { void _onCardFormCompleted() { print('_onCardFormCompleted'); showAlertDialog( - context: HomeScreen.scaffoldKey.currentContext!, - title: 'カード登録', - message: 'カードを登録しました。'); + context: HomeScreen.scaffoldKey.currentContext!, + title: 'カード登録', + message: 'カードを登録しました。', + ); } FutureOr _onCardFormProducedToken(Token token) async { @@ -169,7 +179,8 @@ class HomeScreenState extends State { FutureOr _onApplePayProducedToken(Token token) async { print('_onApplePayProducedToken'); if (backendUrl.isEmpty) { - final message = """ + final message = + """ `backendUrl` is not replaced yet. You can send token(${token.id}) to your own server to make Customer etc. """; @@ -185,7 +196,8 @@ You can send token(${token.id}) to your own server to make Customer etc. } FutureOr _onApplePayFailedRequestToken( - ErrorInfo errorInfo) async { + ErrorInfo errorInfo, + ) async { print('_onApplePayFailedRequestToken'); print('errorCode ${errorInfo.errorCode}'); print('errorMessage ${errorInfo.errorMessage}'); @@ -198,44 +210,49 @@ You can send token(${token.id}) to your own server to make Customer etc. @override Widget build(BuildContext context) => MaterialApp( - home: Scaffold( - key: HomeScreen.scaffoldKey, - appBar: AppBar( - title: const Text('PAY.JP Flutter Plugin Sample'), - ), - body: _isLoading - ? Center(child: CircularProgressIndicator()) - : ListView( - children: [ - material.Card( - child: ListTile( - title: Text('CardForm Sample (MultiLine)'), - subtitle: Text('Tap here to start card form.'), - onTap: () { - _showSheetToStartCardForm( - formType: CardFormType.multiLine); - }, - )), - material.Card( - child: ListTile( - title: Text('CardForm Sample (CardDisplay)'), - subtitle: Text('Tap here to start card form.'), - onTap: () { - _showSheetToStartCardForm( - formType: CardFormType.cardDisplay); - }, - )), - material.Card( - child: ListTile( - title: Text('Start ApplePay Sample (iOS only)'), - subtitle: Text(_canUseApplePay + home: Scaffold( + key: HomeScreen.scaffoldKey, + appBar: AppBar(title: const Text('PAY.JP Flutter Plugin Sample')), + body: _isLoading + ? Center(child: CircularProgressIndicator()) + : ListView( + children: [ + material.Card( + child: ListTile( + title: Text('CardForm Sample (MultiLine)'), + subtitle: Text('Tap here to start card form.'), + onTap: () { + _showSheetToStartCardForm( + formType: CardFormType.multiLine, + ); + }, + ), + ), + material.Card( + child: ListTile( + title: Text('CardForm Sample (CardDisplay)'), + subtitle: Text('Tap here to start card form.'), + onTap: () { + _showSheetToStartCardForm( + formType: CardFormType.cardDisplay, + ); + }, + ), + ), + material.Card( + child: ListTile( + title: Text('Start ApplePay Sample (iOS only)'), + subtitle: Text( + _canUseApplePay ? 'Sample payment with Apple Pay.' - : 'This device is not supported.'), - enabled: _canUseApplePay, - onTap: _onStartApplePay, - )), - ], + : 'This device is not supported.', + ), + enabled: _canUseApplePay, + onTap: _onStartApplePay, + ), ), - ), - ); + ], + ), + ), + ); } diff --git a/example/lib/sample_backend_service.dart b/example/lib/sample_backend_service.dart index d223292..f1fb632 100644 --- a/example/lib/sample_backend_service.dart +++ b/example/lib/sample_backend_service.dart @@ -29,7 +29,8 @@ class ApiException implements Exception { Future saveCard(Token token) async { if (backendUrl.isEmpty) { - final message = """ + final message = + """ `backendUrl` is not replaced yet. You can send token(${token.id}) to your own server to make Customer etc. """; diff --git a/example/lib/widgets/alert_dialog.dart b/example/lib/widgets/alert_dialog.dart index 8c8ba40..a07c66e 100644 --- a/example/lib/widgets/alert_dialog.dart +++ b/example/lib/widgets/alert_dialog.dart @@ -9,42 +9,43 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -Future showAlertDialog( - {required BuildContext context, - required String title, - required String message, - String button = "OK"}) { +Future showAlertDialog({ + required BuildContext context, + required String title, + required String message, + String button = "OK", +}) { final titleText = Text(title); - final content = SingleChildScrollView( - child: Text(message), - ); + final content = SingleChildScrollView(child: Text(message)); final buttonText = Text(button); if (Platform.isIOS) { return showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: titleText, - content: content, - actions: [ - CupertinoDialogAction( - child: buttonText, - onPressed: () => Navigator.of(context).pop(), - ) - ], - )); + context: context, + builder: (context) => CupertinoAlertDialog( + title: titleText, + content: content, + actions: [ + CupertinoDialogAction( + child: buttonText, + onPressed: () => Navigator.of(context).pop(), + ), + ], + ), + ); } else { return showDialog( - context: context, - barrierDismissible: true, - builder: (context) => AlertDialog( - title: titleText, - content: content, - actions: [ - TextButton( - child: buttonText, - onPressed: () => Navigator.of(context).pop(), - ), - ], - )); + context: context, + barrierDismissible: true, + builder: (context) => AlertDialog( + title: titleText, + content: content, + actions: [ + TextButton( + child: buttonText, + onPressed: () => Navigator.of(context).pop(), + ), + ], + ), + ); } } diff --git a/lib/src/card.dart b/lib/src/card.dart index ae63992..3d69ace 100644 --- a/lib/src/card.dart +++ b/lib/src/card.dart @@ -141,145 +141,236 @@ class _$CardSerializer implements StructuredSerializer { final String wireName = r'Card'; @override - Iterable serialize(Serializers serializers, Card object, - {FullType specifiedType = FullType.unspecified}) { + Iterable serialize( + Serializers serializers, + Card object, { + FullType specifiedType = FullType.unspecified, + }) { final result = []; result ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(String))); + ..add( + serializers.serialize(object.id, specifiedType: const FullType(String)), + ); if (object.object != null) { result ..add(r'object') - ..add(serializers.serialize(object.object, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.object, + specifiedType: const FullType(String), + ), + ); } if (object.created != null) { result ..add(r'created') - ..add(serializers.serialize(object.created, - specifiedType: const FullType(int))); + ..add( + serializers.serialize( + object.created, + specifiedType: const FullType(int), + ), + ); } if (object.name != null) { result ..add(r'name') - ..add(serializers.serialize(object.name, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.name, + specifiedType: const FullType(String), + ), + ); } if (object.last4 != null) { result ..add(r'last4') - ..add(serializers.serialize(object.last4, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.last4, + specifiedType: const FullType(String), + ), + ); } if (object.expMonth != null) { result ..add(r'exp_month') - ..add(serializers.serialize(object.expMonth, - specifiedType: const FullType(int))); + ..add( + serializers.serialize( + object.expMonth, + specifiedType: const FullType(int), + ), + ); } if (object.expYear != null) { result ..add(r'exp_year') - ..add(serializers.serialize(object.expYear, - specifiedType: const FullType(int))); + ..add( + serializers.serialize( + object.expYear, + specifiedType: const FullType(int), + ), + ); } if (object.brand != null) { result ..add(r'brand') - ..add(serializers.serialize(object.brand, - specifiedType: const FullType(CardBrand))); + ..add( + serializers.serialize( + object.brand, + specifiedType: const FullType(CardBrand), + ), + ); } if (object.cvcCheck != null) { result ..add(r'cvc_check') - ..add(serializers.serialize(object.cvcCheck, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.cvcCheck, + specifiedType: const FullType(String), + ), + ); } if (object.threeDSecureStatus != null) { result ..add(r'three_d_secure_status') - ..add(serializers.serialize(object.threeDSecureStatus, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.threeDSecureStatus, + specifiedType: const FullType(String), + ), + ); } if (object.fingerprint != null) { result ..add(r'fingerprint') - ..add(serializers.serialize(object.fingerprint, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.fingerprint, + specifiedType: const FullType(String), + ), + ); } if (object.email != null) { result ..add(r'email') - ..add(serializers.serialize(object.email, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.email, + specifiedType: const FullType(String), + ), + ); } if (object.phone != null) { result ..add(r'phone') - ..add(serializers.serialize(object.phone, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.phone, + specifiedType: const FullType(String), + ), + ); } if (object.addressState != null) { result ..add(r'address_state') - ..add(serializers.serialize(object.addressState, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressState, + specifiedType: const FullType(String), + ), + ); } if (object.addressCity != null) { result ..add(r'address_city') - ..add(serializers.serialize(object.addressCity, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressCity, + specifiedType: const FullType(String), + ), + ); } if (object.addressLine1 != null) { result ..add(r'address_line1') - ..add(serializers.serialize(object.addressLine1, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressLine1, + specifiedType: const FullType(String), + ), + ); } if (object.addressLine2 != null) { result ..add(r'address_line2') - ..add(serializers.serialize(object.addressLine2, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressLine2, + specifiedType: const FullType(String), + ), + ); } if (object.country != null) { result ..add(r'country') - ..add(serializers.serialize(object.country, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.country, + specifiedType: const FullType(String), + ), + ); } if (object.addressZip != null) { result ..add(r'address_zip') - ..add(serializers.serialize(object.addressZip, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressZip, + specifiedType: const FullType(String), + ), + ); } if (object.addressZipCheck != null) { result ..add(r'address_zip_check') - ..add(serializers.serialize(object.addressZipCheck, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.addressZipCheck, + specifiedType: const FullType(String), + ), + ); } if (object.customer != null) { result ..add(r'customer') - ..add(serializers.serialize(object.customer, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.customer, + specifiedType: const FullType(String), + ), + ); } if (object.metadata != null) { result ..add(r'metadata') - ..add(serializers.serialize(object.metadata, - specifiedType: const FullType(JsonObject))); + ..add( + serializers.serialize( + object.metadata, + specifiedType: const FullType(JsonObject), + ), + ); } return result; } @override - Card deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { + Card deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { final result = CardBuilder(); final iterator = serialized.iterator; @@ -290,92 +381,171 @@ class _$CardSerializer implements StructuredSerializer { final Object? value = iterator.current; switch (key) { case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.id = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'object': - result.object = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.object = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'created': - result.created = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; + result.created = + serializers.deserialize(value, specifiedType: const FullType(int)) + as int; break; case r'name': - result.name = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.name = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'last4': - result.last4 = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.last4 = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'exp_month': - result.expMonth = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; + result.expMonth = + serializers.deserialize(value, specifiedType: const FullType(int)) + as int; break; case r'exp_year': - result.expYear = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; + result.expYear = + serializers.deserialize(value, specifiedType: const FullType(int)) + as int; break; case r'brand': - result.brand = serializers.deserialize(value, - specifiedType: const FullType(CardBrand)) as CardBrand; + result.brand = + serializers.deserialize( + value, + specifiedType: const FullType(CardBrand), + ) + as CardBrand; break; case r'cvc_check': - result.cvcCheck = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.cvcCheck = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'three_d_secure_status': - result.threeDSecureStatus = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.threeDSecureStatus = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'fingerprint': - result.fingerprint = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.fingerprint = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'email': - result.email = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.email = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'phone': - result.phone = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.phone = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_state': - result.addressState = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressState = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_city': - result.addressCity = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressCity = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_line1': - result.addressLine1 = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressLine1 = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_line2': - result.addressLine2 = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressLine2 = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'country': - result.country = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.country = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_zip': - result.addressZip = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressZip = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'address_zip_check': - result.addressZipCheck = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.addressZipCheck = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'customer': - result.customer = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.customer = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'metadata': - result.metadata = serializers.deserialize(value, - specifiedType: const FullType(JsonObject)) as JsonObject; + result.metadata = + serializers.deserialize( + value, + specifiedType: const FullType(JsonObject), + ) + as JsonObject; break; } } diff --git a/lib/src/card.g.dart b/lib/src/card.g.dart index cad05c4..4f46b93 100644 --- a/lib/src/card.g.dart +++ b/lib/src/card.g.dart @@ -55,30 +55,30 @@ class _$Card extends Card { factory _$Card([void Function(CardBuilder)? updates]) => (new CardBuilder()..update(updates))._build(); - _$Card._( - {required this.id, - this.object, - this.created, - this.name, - this.last4, - this.expMonth, - this.expYear, - this.brand, - this.cvcCheck, - this.threeDSecureStatus, - this.fingerprint, - this.email, - this.phone, - this.addressState, - this.addressCity, - this.addressLine1, - this.addressLine2, - this.country, - this.addressZip, - this.addressZipCheck, - this.customer, - this.metadata}) - : super._() { + _$Card._({ + required this.id, + this.object, + this.created, + this.name, + this.last4, + this.expMonth, + this.expYear, + this.brand, + this.cvcCheck, + this.threeDSecureStatus, + this.fingerprint, + this.email, + this.phone, + this.addressState, + this.addressCity, + this.addressLine1, + this.addressLine2, + this.country, + this.addressZip, + this.addressZipCheck, + this.customer, + this.metadata, + }) : super._() { BuiltValueNullFieldError.checkNotNull(id, r'Card', 'id'); } @@ -317,30 +317,32 @@ class CardBuilder implements Builder { Card build() => _build(); _$Card _build() { - final _$result = _$v ?? + final _$result = + _$v ?? new _$Card._( - id: BuiltValueNullFieldError.checkNotNull(id, r'Card', 'id'), - object: object, - created: created, - name: name, - last4: last4, - expMonth: expMonth, - expYear: expYear, - brand: brand, - cvcCheck: cvcCheck, - threeDSecureStatus: threeDSecureStatus, - fingerprint: fingerprint, - email: email, - phone: phone, - addressState: addressState, - addressCity: addressCity, - addressLine1: addressLine1, - addressLine2: addressLine2, - country: country, - addressZip: addressZip, - addressZipCheck: addressZipCheck, - customer: customer, - metadata: metadata); + id: BuiltValueNullFieldError.checkNotNull(id, r'Card', 'id'), + object: object, + created: created, + name: name, + last4: last4, + expMonth: expMonth, + expYear: expYear, + brand: brand, + cvcCheck: cvcCheck, + threeDSecureStatus: threeDSecureStatus, + fingerprint: fingerprint, + email: email, + phone: phone, + addressState: addressState, + addressCity: addressCity, + addressLine1: addressLine1, + addressLine2: addressLine2, + country: country, + addressZip: addressZip, + addressZipCheck: addressZipCheck, + customer: customer, + metadata: metadata, + ); replace(_$result); return _$result; } diff --git a/lib/src/card_brand.g.dart b/lib/src/card_brand.g.dart index a09e927..a734fb7 100644 --- a/lib/src/card_brand.g.dart +++ b/lib/src/card_brand.g.dart @@ -67,15 +67,20 @@ class _$CardBrandSerializer implements PrimitiveSerializer { final String wireName = 'CardBrand'; @override - Object serialize(Serializers serializers, CardBrand object, - {FullType specifiedType = FullType.unspecified}) => - _toWire[object.name] ?? object.name; + Object serialize( + Serializers serializers, + CardBrand object, { + FullType specifiedType = FullType.unspecified, + }) => _toWire[object.name] ?? object.name; @override - CardBrand deserialize(Serializers serializers, Object serialized, - {FullType specifiedType = FullType.unspecified}) => - CardBrand.valueOf( - _fromWire[serialized] ?? (serialized is String ? serialized : '')); + CardBrand deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) => CardBrand.valueOf( + _fromWire[serialized] ?? (serialized is String ? serialized : ''), + ); } // ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/error_info.g.dart b/lib/src/error_info.g.dart index 2e57a3b..c8b7eb9 100644 --- a/lib/src/error_info.g.dart +++ b/lib/src/error_info.g.dart @@ -15,26 +15,38 @@ class _$ErrorInfoSerializer implements StructuredSerializer { final String wireName = 'ErrorInfo'; @override - Iterable serialize(Serializers serializers, ErrorInfo object, - {FullType specifiedType = FullType.unspecified}) { + Iterable serialize( + Serializers serializers, + ErrorInfo object, { + FullType specifiedType = FullType.unspecified, + }) { final result = [ 'errorType', - serializers.serialize(object.errorType, - specifiedType: const FullType(String)), + serializers.serialize( + object.errorType, + specifiedType: const FullType(String), + ), 'errorCode', - serializers.serialize(object.errorCode, - specifiedType: const FullType(int)), + serializers.serialize( + object.errorCode, + specifiedType: const FullType(int), + ), 'errorMessage', - serializers.serialize(object.errorMessage, - specifiedType: const FullType(String)), + serializers.serialize( + object.errorMessage, + specifiedType: const FullType(String), + ), ]; return result; } @override - ErrorInfo deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { + ErrorInfo deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { final result = new ErrorInfoBuilder(); final iterator = serialized.iterator; @@ -44,16 +56,28 @@ class _$ErrorInfoSerializer implements StructuredSerializer { final Object? value = iterator.current; switch (key) { case 'errorType': - result.errorType = serializers.deserialize(value, - specifiedType: const FullType(String))! as String; + result.errorType = + serializers.deserialize( + value, + specifiedType: const FullType(String), + )! + as String; break; case 'errorCode': - result.errorCode = serializers.deserialize(value, - specifiedType: const FullType(int))! as int; + result.errorCode = + serializers.deserialize( + value, + specifiedType: const FullType(int), + )! + as int; break; case 'errorMessage': - result.errorMessage = serializers.deserialize(value, - specifiedType: const FullType(String))! as String; + result.errorMessage = + serializers.deserialize( + value, + specifiedType: const FullType(String), + )! + as String; break; } } @@ -73,15 +97,18 @@ class _$ErrorInfo extends ErrorInfo { factory _$ErrorInfo([void Function(ErrorInfoBuilder)? updates]) => (new ErrorInfoBuilder()..update(updates))._build(); - _$ErrorInfo._( - {required this.errorType, - required this.errorCode, - required this.errorMessage}) - : super._() { + _$ErrorInfo._({ + required this.errorType, + required this.errorCode, + required this.errorMessage, + }) : super._() { BuiltValueNullFieldError.checkNotNull(errorType, r'ErrorInfo', 'errorType'); BuiltValueNullFieldError.checkNotNull(errorCode, r'ErrorInfo', 'errorCode'); BuiltValueNullFieldError.checkNotNull( - errorMessage, r'ErrorInfo', 'errorMessage'); + errorMessage, + r'ErrorInfo', + 'errorMessage', + ); } @override @@ -163,14 +190,25 @@ class ErrorInfoBuilder implements Builder { ErrorInfo build() => _build(); _$ErrorInfo _build() { - final _$result = _$v ?? + final _$result = + _$v ?? new _$ErrorInfo._( - errorType: BuiltValueNullFieldError.checkNotNull( - errorType, r'ErrorInfo', 'errorType'), - errorCode: BuiltValueNullFieldError.checkNotNull( - errorCode, r'ErrorInfo', 'errorCode'), - errorMessage: BuiltValueNullFieldError.checkNotNull( - errorMessage, r'ErrorInfo', 'errorMessage')); + errorType: BuiltValueNullFieldError.checkNotNull( + errorType, + r'ErrorInfo', + 'errorType', + ), + errorCode: BuiltValueNullFieldError.checkNotNull( + errorCode, + r'ErrorInfo', + 'errorCode', + ), + errorMessage: BuiltValueNullFieldError.checkNotNull( + errorMessage, + r'ErrorInfo', + 'errorMessage', + ), + ); replace(_$result); return _$result; } diff --git a/lib/src/payjp.dart b/lib/src/payjp.dart index ea9f1ba..508d6ba 100644 --- a/lib/src/payjp.dart +++ b/lib/src/payjp.dart @@ -20,12 +20,12 @@ import 'package:payjp_flutter/src/token.dart'; typedef OnCardFormCompletedCallback = void Function(); typedef OnCardFormCanceledCallback = void Function(); -typedef OnCardFormProducedTokenCallback = FutureOr Function( - Token token); -typedef OnApplePayProducedTokenCallback = FutureOr Function( - Token token); -typedef OnApplePayFailedRequestTokenCallback = FutureOr - Function(ErrorInfo errorInfo); +typedef OnCardFormProducedTokenCallback = + FutureOr Function(Token token); +typedef OnApplePayProducedTokenCallback = + FutureOr Function(Token token); +typedef OnApplePayFailedRequestTokenCallback = + FutureOr Function(ErrorInfo errorInfo); typedef OnApplePayCompletedCallback = void Function(); // ignore: avoid_classes_with_only_static_members @@ -36,7 +36,7 @@ class Payjp { static OnCardFormProducedTokenCallback? _onCardFormProducedTokenCallback; static OnApplePayProducedTokenCallback? _onApplePayProducedTokenCallback; static OnApplePayFailedRequestTokenCallback? - _onApplePayFailedRequestTokenCallback; + _onApplePayFailedRequestTokenCallback; static OnApplePayCompletedCallback? _onApplePayCompletedCallback; @visibleForTesting @@ -56,8 +56,10 @@ class Payjp { break; case 'onCardFormProducedToken': CallbackResult result = CallbackResultOk(); - final token = - _serializers.deserializeWith(Token.serializer, call.arguments)!; + final token = _serializers.deserializeWith( + Token.serializer, + call.arguments, + )!; final resultFutureOr = _onCardFormProducedTokenCallback?.call(token); if (resultFutureOr != null) { if (resultFutureOr is Future) { @@ -74,8 +76,10 @@ class Payjp { break; case 'onApplePayProducedToken': CallbackResult result = CallbackResultOk(); - final token = - _serializers.deserializeWith(Token.serializer, call.arguments)!; + final token = _serializers.deserializeWith( + Token.serializer, + call.arguments, + )!; final resultFutureOr = _onApplePayProducedTokenCallback?.call(token); if (resultFutureOr != null) { if (resultFutureOr is Future) { @@ -85,19 +89,23 @@ class Payjp { } final params = { 'isSuccess': result.isOk(), - 'errorMessage': - result is CallbackResultError ? result.message : null, + 'errorMessage': result is CallbackResultError + ? result.message + : null, }; await channel.invokeMethod('completeApplePay', params); } break; case 'onApplePayFailedRequestToken': - final errorInfo = - _serializers.deserializeWith(ErrorInfo.serializer, call.arguments)!; + final errorInfo = _serializers.deserializeWith( + ErrorInfo.serializer, + call.arguments, + )!; var message = errorInfo.errorMessage; CallbackResultError result; - final resultFutureOr = - _onApplePayFailedRequestTokenCallback?.call(errorInfo); + final resultFutureOr = _onApplePayFailedRequestTokenCallback?.call( + errorInfo, + ); if (resultFutureOr != null) { if (resultFutureOr is Future) { result = await resultFutureOr; @@ -128,17 +136,18 @@ class Payjp { /// You can also set [locale] manually, which is following the device setting /// by default. [threeDSecureRedirect] is required only if you support 3D Secure. /// You can register key and url in [PAY.JP dashboard](https://pay.jp/d/settings) if activated. - static Future init( - {required String publicKey, - bool debugEnabled = false, - Locale? locale, - PayjpThreeDSecureRedirect? threeDSecureRedirect}) async { + static Future init({ + required String publicKey, + bool debugEnabled = false, + Locale? locale, + PayjpThreeDSecureRedirect? threeDSecureRedirect, + }) async { final params = { 'publicKey': publicKey, 'debugEnabled': debugEnabled, 'locale': locale?.toLanguageTag(), 'threeDSecureRedirectUrl': threeDSecureRedirect?.url, - 'threeDSecureRedirectKey': threeDSecureRedirect?.key + 'threeDSecureRedirectKey': threeDSecureRedirect?.key, }; await channel.invokeMethod('initialize', params); } @@ -150,22 +159,25 @@ class Payjp { /// [tenantId] is a parameter only for platform API. /// [cardFormType] is type of CardForm.(default MultiLine) /// [extraAttributes] is a list of extra attributes for card form. (default Email and Phone) - static Future startCardForm( - {OnCardFormCanceledCallback? onCardFormCanceledCallback, - OnCardFormCompletedCallback? onCardFormCompletedCallback, - OnCardFormProducedTokenCallback? onCardFormProducedTokenCallback, - String? tenantId, - CardFormType cardFormType = CardFormType.multiLine, - List? extraAttributes, - bool? useThreeDSecure}) async { + static Future startCardForm({ + OnCardFormCanceledCallback? onCardFormCanceledCallback, + OnCardFormCompletedCallback? onCardFormCompletedCallback, + OnCardFormProducedTokenCallback? onCardFormProducedTokenCallback, + String? tenantId, + CardFormType cardFormType = CardFormType.multiLine, + List? extraAttributes, + bool? useThreeDSecure, + }) async { _onCardFormCanceledCallback = onCardFormCanceledCallback; _onCardFormCompletedCallback = onCardFormCompletedCallback; _onCardFormProducedTokenCallback = onCardFormProducedTokenCallback; extraAttributes ??= [ExtraAttributeEmail(), ExtraAttributePhone()]; - final extraAttributesEmail = - extraAttributes.whereType().firstOrNull; - final extraAttributesPhone = - extraAttributes.whereType().firstOrNull; + final extraAttributesEmail = extraAttributes + .whereType() + .firstOrNull; + final extraAttributesPhone = extraAttributes + .whereType() + .firstOrNull; final params = { 'tenantId': tenantId, 'cardFormType': cardFormType.name, @@ -174,7 +186,7 @@ class Payjp { 'extraAttributesPhoneEnabled': extraAttributesPhone != null, 'extraAttributesPhonePresetRegion': extraAttributesPhone?.presetRegion, 'extraAttributesPhonePresetNumber': extraAttributesPhone?.presetNumber, - 'useThreeDSecure': useThreeDSecure ?? false + 'useThreeDSecure': useThreeDSecure ?? false, }; await channel.invokeMethod('startCardForm', params); } @@ -186,21 +198,20 @@ class Payjp { /// Keep displaying card form, and show [message] as error message. static Future showTokenProcessingError(String message) async { - final params = { - 'message': message, - }; + final params = {'message': message}; await channel.invokeMethod('showTokenProcessingError', params); } /// Set CardForm Style for iOS. - static Future setIOSCardFormStyle( - {Color? labelTextColor, - Color? inputTextColor, - Color? errorTextColor, - Color? tintColor, - Color? inputFieldBackgroundColor, - Color? submitButtonColor, - Color? highlightColor}) async { + static Future setIOSCardFormStyle({ + Color? labelTextColor, + Color? inputTextColor, + Color? errorTextColor, + Color? tintColor, + Color? inputFieldBackgroundColor, + Color? submitButtonColor, + Color? highlightColor, + }) async { final params = { 'labelTextColor': labelTextColor?.value, // ignore: deprecated_member_use 'inputTextColor': inputTextColor?.value, // ignore: deprecated_member_use @@ -227,17 +238,17 @@ class Payjp { /// to send PAY.JP token to your server. /// /// [requiredBillingAddress] flag is false by default. - static Future makeApplePayToken( - {required String appleMerchantId, - required String currencyCode, - required String countryCode, - required String summaryItemLabel, - required String summaryItemAmount, - bool? requiredBillingAddress, - OnApplePayProducedTokenCallback? onApplePayProducedTokenCallback, - OnApplePayFailedRequestTokenCallback? - onApplePayFailedRequestTokenCallback, - OnApplePayCompletedCallback? onApplePayCompletedCallback}) async { + static Future makeApplePayToken({ + required String appleMerchantId, + required String currencyCode, + required String countryCode, + required String summaryItemLabel, + required String summaryItemAmount, + bool? requiredBillingAddress, + OnApplePayProducedTokenCallback? onApplePayProducedTokenCallback, + OnApplePayFailedRequestTokenCallback? onApplePayFailedRequestTokenCallback, + OnApplePayCompletedCallback? onApplePayCompletedCallback, + }) async { _onApplePayProducedTokenCallback = onApplePayProducedTokenCallback; _onApplePayFailedRequestTokenCallback = onApplePayFailedRequestTokenCallback; @@ -248,7 +259,7 @@ class Payjp { 'countryCode': countryCode, 'summaryItemLabel': summaryItemLabel, 'summaryItemAmount': summaryItemAmount, - 'requiredBillingAddress': requiredBillingAddress ?? false + 'requiredBillingAddress': requiredBillingAddress ?? false, }; await channel.invokeMethod('makeApplePayToken', params); } diff --git a/lib/src/serializers.g.dart b/lib/src/serializers.g.dart index af7b288..852c002 100644 --- a/lib/src/serializers.g.dart +++ b/lib/src/serializers.g.dart @@ -6,11 +6,12 @@ part of 'serializers.dart'; // BuiltValueGenerator // ************************************************************************** -Serializers _$serializers = (new Serializers().toBuilder() - ..add(Card.serializer) - ..add(CardBrand.serializer) - ..add(ErrorInfo.serializer) - ..add(Token.serializer)) - .build(); +Serializers _$serializers = + (new Serializers().toBuilder() + ..add(Card.serializer) + ..add(CardBrand.serializer) + ..add(ErrorInfo.serializer) + ..add(Token.serializer)) + .build(); // ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/token.dart b/lib/src/token.dart index 4d829b5..ac75b1f 100644 --- a/lib/src/token.dart +++ b/lib/src/token.dart @@ -59,39 +59,60 @@ class _$TokenSerializer implements StructuredSerializer { final String wireName = r'Token'; @override - Iterable serialize(Serializers serializers, Token object, - {FullType specifiedType = FullType.unspecified}) { + Iterable serialize( + Serializers serializers, + Token object, { + FullType specifiedType = FullType.unspecified, + }) { final result = []; result ..add(r'id') - ..add(serializers.serialize(object.id, - specifiedType: const FullType(String))); + ..add( + serializers.serialize(object.id, specifiedType: const FullType(String)), + ); result ..add(r'card') - ..add(serializers.serialize(object.card, - specifiedType: const FullType(Card))); + ..add( + serializers.serialize(object.card, specifiedType: const FullType(Card)), + ); result ..add(r'created') - ..add(serializers.serialize(object.created, - specifiedType: const FullType(int))); + ..add( + serializers.serialize( + object.created, + specifiedType: const FullType(int), + ), + ); result ..add(r'livemode') - ..add(serializers.serialize(object.livemode, - specifiedType: const FullType(bool))); + ..add( + serializers.serialize( + object.livemode, + specifiedType: const FullType(bool), + ), + ); result ..add(r'object') - ..add(serializers.serialize(object.object, - specifiedType: const FullType(String))); + ..add( + serializers.serialize( + object.object, + specifiedType: const FullType(String), + ), + ); result ..add(r'used') - ..add(serializers.serialize(object.used, - specifiedType: const FullType(bool))); + ..add( + serializers.serialize(object.used, specifiedType: const FullType(bool)), + ); return result; } @override - Token deserialize(Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { + Token deserialize( + Serializers serializers, + Iterable serialized, { + FullType specifiedType = FullType.unspecified, + }) { final result = TokenBuilder(); final iterator = serialized.iterator; @@ -102,28 +123,47 @@ class _$TokenSerializer implements StructuredSerializer { final Object? value = iterator.current; switch (key) { case r'id': - result.id = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.id = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'card': - result.card.replace(serializers.deserialize(value, - specifiedType: const FullType(Card)) as Card); + result.card.replace( + serializers.deserialize(value, specifiedType: const FullType(Card)) + as Card, + ); break; case r'created': - result.created = serializers.deserialize(value, - specifiedType: const FullType(int)) as int; + result.created = + serializers.deserialize(value, specifiedType: const FullType(int)) + as int; break; case r'livemode': - result.livemode = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; + result.livemode = + serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) + as bool; break; case r'object': - result.object = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; + result.object = + serializers.deserialize( + value, + specifiedType: const FullType(String), + ) + as String; break; case r'used': - result.used = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; + result.used = + serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) + as bool; break; } } diff --git a/lib/src/token.g.dart b/lib/src/token.g.dart index c172b68..a87fcb0 100644 --- a/lib/src/token.g.dart +++ b/lib/src/token.g.dart @@ -23,14 +23,14 @@ class _$Token extends Token { factory _$Token([void Function(TokenBuilder)? updates]) => (new TokenBuilder()..update(updates))._build(); - _$Token._( - {required this.id, - required this.card, - required this.created, - required this.livemode, - required this.object, - required this.used}) - : super._() { + _$Token._({ + required this.id, + required this.card, + required this.created, + required this.livemode, + required this.object, + required this.used, + }) : super._() { BuiltValueNullFieldError.checkNotNull(id, r'Token', 'id'); BuiltValueNullFieldError.checkNotNull(card, r'Token', 'card'); BuiltValueNullFieldError.checkNotNull(created, r'Token', 'created'); @@ -146,18 +146,28 @@ class TokenBuilder implements Builder { _$Token _build() { _$Token _$result; try { - _$result = _$v ?? + _$result = + _$v ?? new _$Token._( - id: BuiltValueNullFieldError.checkNotNull(id, r'Token', 'id'), - card: card.build(), - created: BuiltValueNullFieldError.checkNotNull( - created, r'Token', 'created'), - livemode: BuiltValueNullFieldError.checkNotNull( - livemode, r'Token', 'livemode'), - object: BuiltValueNullFieldError.checkNotNull( - object, r'Token', 'object'), - used: BuiltValueNullFieldError.checkNotNull( - used, r'Token', 'used')); + id: BuiltValueNullFieldError.checkNotNull(id, r'Token', 'id'), + card: card.build(), + created: BuiltValueNullFieldError.checkNotNull( + created, + r'Token', + 'created', + ), + livemode: BuiltValueNullFieldError.checkNotNull( + livemode, + r'Token', + 'livemode', + ), + object: BuiltValueNullFieldError.checkNotNull( + object, + r'Token', + 'object', + ), + used: BuiltValueNullFieldError.checkNotNull(used, r'Token', 'used'), + ); } catch (_) { late String _$failedField; try { @@ -165,7 +175,10 @@ class TokenBuilder implements Builder { card.build(); } catch (e) { throw new BuiltValueNestedFieldError( - r'Token', _$failedField, e.toString()); + r'Token', + _$failedField, + e.toString(), + ); } rethrow; }