From cf60ec41f4a8176ab6a59c78ef061187b50e323b Mon Sep 17 00:00:00 2001 From: Nikita Tepliakov Date: Thu, 8 Nov 2018 21:58:31 +0800 Subject: [PATCH] Upgrade to support new version --- lib/screens/finish_registration.dart | 2 +- lib/screens/purchase.dart | 10 +++--- lib/screens/registration.dart | 2 +- lib/screens/splash.dart | 8 ++--- pubspec.lock | 50 ++++++++++------------------ pubspec.yaml | 6 ++-- 6 files changed, 32 insertions(+), 46 deletions(-) diff --git a/lib/screens/finish_registration.dart b/lib/screens/finish_registration.dart index a0e8832..e9435e5 100644 --- a/lib/screens/finish_registration.dart +++ b/lib/screens/finish_registration.dart @@ -77,7 +77,7 @@ class RegistrationScreenState extends BaseState { helper.getToken().then((token) { getCheckTokenStatusRequest(token).then((response) { setState(() { - _tokenActive = JSON.decode(response.body)['active']; + _tokenActive = json.decode(response.body)['active']; }); }).catchError((error) { print(error.toString()); diff --git a/lib/screens/purchase.dart b/lib/screens/purchase.dart index afdf6b8..f01b3fc 100644 --- a/lib/screens/purchase.dart +++ b/lib/screens/purchase.dart @@ -37,7 +37,7 @@ class PurchaseScreenState extends BaseState { bool isAutomaticallyImplyLeading() => false; PurchaseScreenState(SqliteHelper helper, String app, String userString, String card) : super(helper, app) { - this.user = JSON.decode(userString); + this.user = json.decode(userString); this.card = card; } @@ -239,8 +239,8 @@ class PurchaseScreenState extends BaseState { } catch(error) { print(error.toString()); } - Map loyality = JSON.decode(response.body); - Map coupons = JSON.decode(couponResponse.body); + Map loyality = json.decode(response.body); + Map coupons = json.decode(couponResponse.body); coupons['results'].forEach((couponItem) { couponItem['isSet'] = false; @@ -378,7 +378,7 @@ class PurchaseScreenState extends BaseState { try { purchaseResponse = await getPurchaseRequest(user['purchases_url'], body, token); - purchase = JSON.decode(purchaseResponse.body); + purchase = json.decode(purchaseResponse.body); } catch(error) { purchaseInProgress = false; print(error.toString()); @@ -402,7 +402,7 @@ class PurchaseScreenState extends BaseState { print(error.toString()); } - Map coupons = JSON.decode(couponsResponse.body); + Map coupons = json.decode(couponsResponse.body); new Future.delayed(const Duration(milliseconds: 200), () { print('show purchase success!'); diff --git a/lib/screens/registration.dart b/lib/screens/registration.dart index 300c177..09bde7a 100644 --- a/lib/screens/registration.dart +++ b/lib/screens/registration.dart @@ -106,7 +106,7 @@ class RegistrationScreenState extends BaseState { print(response.body); print(response.statusCode.toString()); - Map parsedMap = JSON.decode(response.body); + Map parsedMap = json.decode(response.body); if (response.statusCode == 201) { helper.createSession(merchantID, posID, parsedMap['token']).then((_) { diff --git a/lib/screens/splash.dart b/lib/screens/splash.dart index bc43efd..c678419 100644 --- a/lib/screens/splash.dart +++ b/lib/screens/splash.dart @@ -120,7 +120,7 @@ class _SplashScreenState extends BaseState { showNextScreen(new RegistrationScreen(helper, app)); }); } else { - Map status = JSON.decode(statusResponse.body); + Map status = json.decode(statusResponse.body); bool active = status['active'] == null ? false : status['active']; if (active) { @@ -161,7 +161,7 @@ class _SplashScreenState extends BaseState { /// Очищаем бд, делаем запрос на удаление токена. Future clearToken(Response response, SqliteHelper helper) async { helper.clear().then((_) { - Map parsedMap = JSON.decode(response.body); + Map parsedMap = json.decode(response.body); getDeleteTokenRequest(parsedMap['token']).then((_) { showNextScreen(new RegistrationScreen(helper, app)); }).catchError((error) { @@ -201,7 +201,7 @@ class _SplashScreenState extends BaseState { if (userResponse != null) { print('I have user in method handler!'); - List users = JSON.decode(userResponse.body); + List users = json.decode(userResponse.body); if (users.length > 0) { return users[0]; } else { @@ -238,7 +238,7 @@ class _SplashScreenState extends BaseState { } else { String userString = call.arguments[0] is String ? call.arguments[0] - : JSON.encode(call.arguments[0]); + : json.encode(call.arguments[0]); print(userString); String card = call.arguments[1]; showNextScreen(new PurchaseScreen(helper, app, userString, card)); diff --git a/pubspec.lock b/pubspec.lock index 24d4656..1866fdf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.8" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.6" + version: "1.14.11" flutter: dependency: "direct main" description: flutter @@ -33,14 +33,14 @@ packages: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.11.3+16" + version: "0.12.0" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.1.3" image_picker: dependency: "direct main" description: @@ -48,41 +48,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.2" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.2+1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "1.1.6" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.5.1" + version: "1.6.2" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "0.2.2" + version: "0.4.1" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "1.7.6" + version: "2.0.2" sky_engine: dependency: transitive description: flutter @@ -94,63 +87,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.4.1" sprintf: dependency: "direct main" description: name: sprintf url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "4.0.0" sqflite: dependency: "direct main" description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "0.8.9" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.2" + version: "0.12.2+1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.4" synchronized: dependency: transitive description: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "1.4.0" + version: "1.5.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.5" + version: "1.1.6" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.6" + version: "2.0.8" xml: dependency: "direct main" description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.2.3" sdks: - dart: ">=2.0.0-dev.35 <=2.0.0-dev.55.0.flutter-97b6c2e09d" + dart: ">=2.0.0 <3.0.0" flutter: ">=0.1.4 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 439cf9b..5772327 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,9 +3,9 @@ description: A new Flutter project. dependencies: http: '>=0.11.3+12' - sprintf: "^3.0.2" - path_provider: "^0.2.1+1" - sqflite: any + sprintf: "4.0.0" + path_provider: "0.4.1" + sqflite: "0.12.2+1" image_picker: '^0.4.1' # use for ask permissions @ iOS xml: "^3.0.0" flutter: