@@ -3,6 +3,7 @@ import 'dart:convert';
33import 'package:collection/collection.dart' show IterableExtension;
44import 'package:firebase_messaging/firebase_messaging.dart' ;
55import 'package:flutter_inappwebview/flutter_inappwebview.dart' ;
6+ import 'package:woosignal_shopify_api/money_formatter/money_formatter.dart' ;
67import '/bootstrap/status_alert/models/status_alert_media_configuration.dart' ;
78import '/bootstrap/status_alert/status_alert.dart' ;
89import '/app/models/cart.dart' ;
@@ -18,7 +19,6 @@ import '/config/currency.dart';
1819import '/config/payment_gateways.dart' ;
1920import '/config/keys.dart' ;
2021import 'package:html/parser.dart' ;
21- import 'package:money_formatter/money_formatter.dart' ;
2222import 'package:nylo_framework/nylo_framework.dart' ;
2323import 'package:woosignal_shopify_api/models/response/auth/auth_customer_info.dart' ;
2424import 'package:woosignal_shopify_api/woosignal_shopify_api.dart' ;
@@ -38,7 +38,6 @@ class ThemeColor {
3838 static Color fromHex (String hexColor) => nyHexColor (hexColor);
3939}
4040
41-
4241Future appWooSignalShopify (Function (WooSignalShopify api) api) async {
4342 return await api (WooSignalShopify .instance);
4443}
@@ -53,7 +52,7 @@ bool isProductNew(DateTime? createdAt) {
5352 if (createdAt == null ) false ;
5453 try {
5554 return createdAt.isBetween (
56- DateTime .now ().subtract (Duration (days: 2 )), DateTime .now ()) ??
55+ DateTime .now ().subtract (Duration (days: 2 )), DateTime .now ()) ??
5756 false ;
5857 } on Exception catch (e) {
5958 NyLogger .error (e.toString ());
@@ -82,18 +81,18 @@ Future<List<PaymentType?>> getShopifyPaymentTypes() async {
8281
8382 for (var appPaymentGateway in appPaymentGateways) {
8483 paymentTypes.add (paymentTypeList.firstWhereOrNull (
85- (paymentTypeList) => paymentTypeList.name == appPaymentGateway));
84+ (paymentTypeList) => paymentTypeList.name == appPaymentGateway));
8685 }
8786
8887 return paymentTypes.where ((v) => v != null ).toList ();
8988}
9089
9190PaymentType addPayment (
92- {required int id,
93- required String name,
94- required String description,
95- required String assetImage,
96- required Function pay}) =>
91+ {required int id,
92+ required String name,
93+ required String description,
94+ required String assetImage,
95+ required Function pay}) =>
9796 PaymentType (
9897 id: id,
9998 name: name,
@@ -104,9 +103,9 @@ PaymentType addPayment(
104103
105104showStatusAlert (context,
106105 {required String title,
107- required String subtitle,
108- IconData ? icon,
109- int ? duration}) {
106+ required String subtitle,
107+ IconData ? icon,
108+ int ? duration}) {
110109 StatusAlert .show (
111110 context,
112111 duration: Duration (seconds: duration ?? 2 ),
@@ -127,7 +126,7 @@ String moneyFormatter(double amount) {
127126 amount: amount,
128127 settings: MoneyFormatterSettings (
129128 symbol:
130- AppHelper .instance.shopifyAppConfig? .currencyMeta? .symbolNative,
129+ AppHelper .instance.shopifyAppConfig? .currencyMeta? .symbolNative,
131130 symbolAndNumberSeparator: "" ),
132131 );
133132 if (appCurrencySymbolPosition == SymbolPositionType .left) {
@@ -177,9 +176,9 @@ bool isNumeric(String? str) {
177176
178177checkoutShopify (
179178 Function (String total, BillingDetails ? billingDetails, Cart cart)
180- completeCheckout) async {
179+ completeCheckout) async {
181180 String cartTotal =
182- await shopify.CheckoutSession .getInstance.total (withFormat: false );
181+ await shopify.CheckoutSession .getInstance.total (withFormat: false );
183182 BillingDetails ? billingDetails =
184183 shopify.CheckoutSession .getInstance.billingDetails;
185184 Cart cart = Cart .getInstance;
@@ -188,9 +187,9 @@ checkoutShopify(
188187
189188navigatorPush (BuildContext context,
190189 {required String routeName,
191- Object ? arguments,
192- bool forgetAll = false ,
193- int ? forgetLast}) {
190+ Object ? arguments,
191+ bool forgetAll = false ,
192+ int ? forgetLast}) {
194193 if (forgetAll) {
195194 Navigator .of (context).pushNamedAndRemoveUntil (
196195 routeName, (Route <dynamic > route) => false ,
@@ -216,13 +215,13 @@ class UserAuth {
216215
217216Future <List <DefaultShipping >> getDefaultShipping () async {
218217 String data =
219- await rootBundle.loadString ('public/json/default_shipping.json' );
218+ await rootBundle.loadString ('public/json/default_shipping.json' );
220219 dynamic dataJson = json.decode (data);
221220 List <DefaultShipping > shipping = [];
222221
223222 dataJson.forEach ((key, value) {
224223 DefaultShipping defaultShipping =
225- DefaultShipping (code: key, country: value['country' ], states: []);
224+ DefaultShipping (code: key, country: value['country' ], states: []);
226225 if (value['states' ] != null ) {
227226 value['states' ].forEach ((key1, value2) {
228227 defaultShipping.states
@@ -237,7 +236,7 @@ Future<List<DefaultShipping>> getDefaultShipping() async {
237236Future <DefaultShipping ?> findCountryMetaForShipping (String countryCode) async {
238237 List <DefaultShipping > defaultShipping = await getDefaultShipping ();
239238 List <DefaultShipping > shippingByCountryCode =
240- defaultShipping.where ((element) => element.code == countryCode).toList ();
239+ defaultShipping.where ((element) => element.code == countryCode).toList ();
241240 if (shippingByCountryCode.isNotEmpty) {
242241 return shippingByCountryCode.first;
243242 }
@@ -247,7 +246,7 @@ Future<DefaultShipping?> findCountryMetaForShipping(String countryCode) async {
247246DefaultShippingState ? findDefaultShippingStateByCode (
248247 DefaultShipping defaultShipping, String code) {
249248 List <DefaultShippingState > defaultShippingStates =
250- defaultShipping.states.where ((state) => state.code == code).toList ();
249+ defaultShipping.states.where ((state) => state.code == code).toList ();
251250 if (defaultShippingStates.isEmpty) {
252251 return null ;
253252 }
@@ -262,7 +261,7 @@ String truncateString(String data, int length) {
262261
263262Future <List <String >> getWishlistProducts () async {
264263 List <String > currentProductsJSON =
265- await (NyStorage .readCollection (Keys .wishlistProducts));
264+ await (NyStorage .readCollection (Keys .wishlistProducts));
266265
267266 return currentProductsJSON;
268267}
@@ -350,7 +349,7 @@ class NyNotification {
350349 /// Get all notifications
351350 static Future <List <NotificationItem >> allNotifications () async {
352351 List <NotificationItem > notifications =
353- await NyStorage .readCollection ("app_notifications" );
352+ await NyStorage .readCollection ("app_notifications" );
354353 String ? userId = await WooSignalShopify .authUserId ();
355354 notifications.removeWhere ((notification) {
356355 if (notification.meta != null &&
0 commit comments