Skip to content

Commit

Permalink
fix(models): fix serialization process
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceramcesoliveros committed Sep 8, 2022
1 parent 6ebac11 commit 200a8e3
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 22 deletions.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
1 change: 1 addition & 0 deletions example/ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions example/ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
41 changes: 41 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
12 changes: 6 additions & 6 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
version: "1.0.5"
equatable:
dependency: transitive
description:
Expand Down Expand Up @@ -134,7 +134,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.5.1"
version: "1.6.0"
plugin_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -209,7 +209,7 @@ packages:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
version: "3.0.4"
webview_flutter_android:
dependency: transitive
description:
Expand All @@ -230,7 +230,7 @@ packages:
name: webview_flutter_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
version: "0.1.0+4"
webview_flutter_wkwebview:
dependency: transitive
description:
Expand All @@ -239,5 +239,5 @@ packages:
source: hosted
version: "2.7.0"
sdks:
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.5.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=2.8.0"
6 changes: 3 additions & 3 deletions lib/src/models/intent/intent_attach.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ class PaymentIntentAttachResponseAttributes extends Equatable {
lastPaymentError: map['last_payment_error'] ?? '',
paymentMethodAllowed:
List<String>.from(map['payment_method_allowed'] ?? const []),
payments: List<CreatePaymentResponse>.from(
map['payments']?.map(CreatePaymentResponse.fromMap) ?? const [],
),
payments: List<Map<String, dynamic>>.from(
map['payments'] ?? [],
).map(CreatePaymentResponse.fromMap).toList(),
nextAction: map['next_action'] != null
? PaymentIntentNextAction.fromMap(map['next_action'])
: null,
Expand Down
8 changes: 5 additions & 3 deletions lib/src/models/intent/intent_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,11 @@ class PaymentIntentResponseAttributes extends Equatable {
lastPaymentError: map['last_payment_error'] ?? '',
paymentMethodAllowed:
List<String>.from(map['payment_method_allowed'] ?? const []),
payments: List<PaymentsIntentResponse>.from(
map['payments']?.map(PaymentsIntentResponse.fromMap) ?? const [],
),
payments: map['payments'] != null
? List<Map<String, dynamic>>.from(
map['payments'] ?? const [],
).map(PaymentsIntentResponse.fromMap).toList()
: [],
nextAction: map['next_action'] != null
? PaymentIntentNextAction.fromMap(map['next_action'])
: null,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/models/payment/payment_list_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class PaymentListAllResponse extends Equatable {
factory PaymentListAllResponse.fromMap(Map<String, dynamic> map) {
return PaymentListAllResponse(
hasMore: map['hasMore'] ?? false,
data: List<PaymentDataResponse?>.from(
map['data']?.map(PaymentDataResponse.fromMap) ?? const [],
),
data: List<Map<String, dynamic>>.from(
map['data'] ?? [],
).map(PaymentDataResponse.fromMap).toList(),
);
}

Expand Down
12 changes: 6 additions & 6 deletions lib/src/models/payment/payment_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class PaymentAttributesResponse extends Equatable {
updatedAt: fromTimeStamp(map['updated_at']),
paidAt: fromTimeStamp(map['paid_at']),
refunds: map['refunds'] != null
? List<PaymentRefundResponse>.from(
map['refunds']?.map(PaymentRefundResponse.fromMap),
)
? List<Map<String, dynamic>>.from(
map['refunds'] ?? [],
).map(PaymentRefundResponse.fromMap).toList()
: null,
taxes: map['taxes'] != null
? List<PaymentTaxResponse>.from(
map['taxes']?.map(PaymentTaxResponse.fromMap),
)
? List<Map<String, dynamic>>.from(
map['taxes'],
).map(PaymentTaxResponse.fromMap).toList()
: null,
);
}
Expand Down

0 comments on commit 200a8e3

Please sign in to comment.