Skip to content

Commit 036d91b

Browse files
committed
v1.1.0 changes. New MetaData base class for models, New update order method.
1 parent 2c04877 commit 036d91b

18 files changed

+201
-278
lines changed

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/Dart_Packages.xml

Lines changed: 66 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries/Flutter_Plugins.xml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 30 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.1.0] - 2020-06-16
2+
3+
* New MetaData base class for models
4+
* New update order method
5+
* Bug fixes
6+
17
## [1.0.9] - 2020-06-03
28

39
* Resolved bug with MetaData on models

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ In your flutter project add the dependency:
1515
``` dart
1616
dependencies:
1717
...
18-
woosignal: ^1.0.9
18+
woosignal: ^1.1.0
1919
```
2020

2121
### Usage example #

example/.flutter-plugins

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This is a generated file; do not edit or check into version control.
2-
device_info=/Users/anthony/Documents/config/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+1/
3-
shared_preferences=/Users/anthony/Documents/config/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.6+3/
4-
shared_preferences_macos=/Users/anthony/Documents/config/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+6/
5-
shared_preferences_web=/Users/anthony/Documents/config/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+4/
2+
device_info=/Users/anthony/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+1/
3+
shared_preferences=/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.6+3/
4+
shared_preferences_macos=/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+6/
5+
shared_preferences_web=/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+4/

example/.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"device_info","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}]}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+1/","dependencies":[]},{"name":"shared_preferences","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.6+3/","dependencies":[]}],"android":[{"name":"device_info","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/device_info-0.4.2+1/","dependencies":[]},{"name":"shared_preferences","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.6+3/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+6/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/Users/anthony/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+4/","dependencies":[]}]},"dependencyGraph":[{"name":"device_info","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]}],"date_created":"2020-06-10 13:32:12.844057","version":"1.18.0-11.1.pre"}

example/pubspec.lock

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
# Generated by pub
22
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
4-
archive:
5-
dependency: transitive
6-
description:
7-
name: archive
8-
url: "https://pub.dartlang.org"
9-
source: hosted
10-
version: "2.0.11"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.5.2"
184
async:
195
dependency: transitive
206
description:
217
name: async
228
url: "https://pub.dartlang.org"
239
source: hosted
24-
version: "2.4.0"
10+
version: "2.4.1"
2511
boolean_selector:
2612
dependency: transitive
2713
description:
2814
name: boolean_selector
2915
url: "https://pub.dartlang.org"
3016
source: hosted
31-
version: "1.0.5"
17+
version: "2.0.0"
3218
charcode:
3319
dependency: transitive
3420
description:
3521
name: charcode
3622
url: "https://pub.dartlang.org"
3723
source: hosted
38-
version: "1.1.2"
24+
version: "1.1.3"
25+
clock:
26+
dependency: transitive
27+
description:
28+
name: clock
29+
url: "https://pub.dartlang.org"
30+
source: hosted
31+
version: "1.0.1"
3932
collection:
4033
dependency: transitive
4134
description:
4235
name: collection
4336
url: "https://pub.dartlang.org"
4437
source: hosted
45-
version: "1.14.11"
38+
version: "1.14.12"
4639
convert:
4740
dependency: transitive
4841
description:
@@ -71,6 +64,13 @@ packages:
7164
url: "https://pub.dartlang.org"
7265
source: hosted
7366
version: "3.0.9"
67+
fake_async:
68+
dependency: transitive
69+
description:
70+
name: fake_async
71+
url: "https://pub.dartlang.org"
72+
source: hosted
73+
version: "1.1.0"
7474
flutter:
7575
dependency: "direct main"
7676
description: flutter
@@ -93,13 +93,6 @@ packages:
9393
url: "https://pub.dartlang.org"
9494
source: hosted
9595
version: "3.1.3"
96-
image:
97-
dependency: transitive
98-
description:
99-
name: image
100-
url: "https://pub.dartlang.org"
101-
source: hosted
102-
version: "2.1.4"
10396
matcher:
10497
dependency: transitive
10598
description:
@@ -120,28 +113,7 @@ packages:
120113
name: path
121114
url: "https://pub.dartlang.org"
122115
source: hosted
123-
version: "1.6.4"
124-
pedantic:
125-
dependency: transitive
126-
description:
127-
name: pedantic
128-
url: "https://pub.dartlang.org"
129-
source: hosted
130-
version: "1.8.0+1"
131-
petitparser:
132-
dependency: transitive
133-
description:
134-
name: petitparser
135-
url: "https://pub.dartlang.org"
136-
source: hosted
137-
version: "2.4.0"
138-
quiver:
139-
dependency: transitive
140-
description:
141-
name: quiver
142-
url: "https://pub.dartlang.org"
143-
source: hosted
144-
version: "2.0.5"
116+
version: "1.7.0"
145117
shared_preferences:
146118
dependency: transitive
147119
description:
@@ -181,7 +153,7 @@ packages:
181153
name: source_span
182154
url: "https://pub.dartlang.org"
183155
source: hosted
184-
version: "1.5.5"
156+
version: "1.7.0"
185157
stack_trace:
186158
dependency: transitive
187159
description:
@@ -216,7 +188,7 @@ packages:
216188
name: test_api
217189
url: "https://pub.dartlang.org"
218190
source: hosted
219-
version: "0.2.11"
191+
version: "0.2.15"
220192
typed_data:
221193
dependency: transitive
222194
description:
@@ -244,14 +216,7 @@ packages:
244216
path: ".."
245217
relative: true
246218
source: path
247-
version: "1.0.6"
248-
xml:
249-
dependency: transitive
250-
description:
251-
name: xml
252-
url: "https://pub.dartlang.org"
253-
source: hosted
254-
version: "3.5.0"
219+
version: "1.1.0"
255220
sdks:
256-
dart: ">2.4.0 <3.0.0"
221+
dart: ">=2.6.0 <3.0.0"
257222
flutter: ">=1.12.13+hotfix.5 <2.0.0"

lib/models/meta_data.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright (c) 2020, WooSignal Ltd.
2+
// All rights reserved.
3+
//
4+
// Redistribution and use in source and binary forms are permitted
5+
// provided that the above copyright notice and this paragraph are
6+
// duplicated in all such forms and that any documentation,
7+
// advertising materials, and other materials related to such
8+
// distribution and use acknowledge that the software was developed
9+
// by the WooSignal. The name of the
10+
// WooSignal may not be used to endorse or promote products derived
11+
// from this software without specific prior written permission.
12+
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13+
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14+
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15+
116
class MetaData {
217
int id;
318
String key;
@@ -8,7 +23,7 @@ class MetaData {
823
MetaData.fromJson(Map<String, dynamic> json) {
924
id = json['id'];
1025
key = json['key'];
11-
value = json['value'];
26+
value = json['value'].toString();
1227
}
1328

1429
Map<String, dynamic> toJson() {

lib/models/response/customer.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1414
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1515

16+
import '../meta_data.dart';
17+
1618
class Customer {
1719
int id;
1820
String dateCreated;
@@ -102,21 +104,6 @@ class Customer {
102104
}
103105
}
104106

105-
class MetaData {
106-
final int id;
107-
final String key;
108-
final String value;
109-
110-
MetaData(this.id, this.key, this.value);
111-
112-
MetaData.fromJson(Map<String, dynamic> json)
113-
: id = json['id'],
114-
key = json['key'],
115-
value = json['value'];
116-
117-
Map<String, dynamic> toJson() => {'id': id, 'key': key, 'value': value};
118-
}
119-
120107
class Billing {
121108
String firstName;
122109
String lastName;

lib/models/response/order.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1414
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1515

16-
import 'package:woosignal/models/meta_data.dart';
16+
import '../meta_data.dart';
1717

1818
class Order {
1919
int id;
@@ -141,8 +141,10 @@ class Order {
141141
dateCompleted = json['date_completed'];
142142
dateCompletedGmt = json['date_completed_gmt'];
143143
cartHash = json['cart_hash'];
144-
metaData =
145-
(json['meta_data'] as List).map((i) => MetaData.fromJson(i)).toList();
144+
if (metaData != null) {
145+
metaData =
146+
(json['meta_data'] as List).map((i) => MetaData.fromJson(i)).toList();
147+
}
146148
if (json['line_items'] != null) {
147149
lineItems = new List<LineItems>();
148150
json['line_items'].forEach((v) {

lib/models/response/product_variation.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1414
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1515

16+
import '../meta_data.dart';
17+
1618
class ProductVariation {
1719
int id;
1820
DateTime dateCreated;
@@ -137,21 +139,6 @@ class ProductVariation {
137139
.toList();
138140
}
139141

140-
class MetaData {
141-
final int id;
142-
final String key;
143-
final String value;
144-
145-
MetaData(this.id, this.key, this.value);
146-
147-
MetaData.fromJson(Map<String, dynamic> json)
148-
: id = json['id'],
149-
key = json['key'],
150-
value = json['value'].toString();
151-
152-
Map<String, dynamic> toJson() => {'id': id, 'key': key, 'value': value};
153-
}
154-
155142
class Category {
156143
final int id;
157144
final String name;

0 commit comments

Comments
 (0)