Skip to content

Commit f4bcc08

Browse files
committed
Release 1.0, null-safety
1 parent 19358aa commit f4bcc08

File tree

9 files changed

+115
-118
lines changed

9 files changed

+115
-118
lines changed

CHANGELOG.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
## 0.1.0
2-
Initial release
3-
4-
## 0.2.0-beta
1+
## [1.0.0]
2+
Stable, null-safe release
3+
### Changed
4+
- Requires Dart version >= 2.12
5+
## [0.2.0-beta]
6+
### Changed
57
- Refactored access to class values. Both ISO and user-assigned codes are
68
accessible through `values` list.
7-
- added `index` getter to match enum behaviour
8-
- added `symbol` getter
99

10+
### Added
11+
- `index` getter to match enum behaviour
12+
- `symbol` getter
13+
14+
## [0.1.0]
15+
Initial release

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ if (code == CountryCode.US) {
2222
print(code.numeric);
2323
}
2424
```
25-
[See more examples](https://github.com/denixport/dart.country/tree/master/example)
26-
25+
[See more examples][examples]
2726

2827
## Bugs and feature requests
2928

3029
Please file feature requests and bugs at the [issue tracker][tracker].
3130

31+
[examples]: https://github.com/denixport/dart.country/tree/master/example
3232
[tracker]: https://github.com/denixport/dart.country/issues

analysis_options.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ analyzer:
66
implicit-dynamic: false
77
errors:
88
dead_code: error
9-
missing_required_param: warning
10-
missing_return: warning
11-
override_on_non_overriding_method: warning
9+
missing_required_param: error
10+
missing_return: error
1211
todo: info
1312
unused_element: error
14-
unused_import: warning
13+
unused_import: error
1514
unused_local_variable: error
1615

1716
linter:

example/example.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ void main() {
77
print(CountryCode.US.symbol); // -> 🇺🇸
88

99
// The list of ISO-assigned codes are in CountryCode.values
10-
var list = CountryCode.values.map<String>((c) => c.alpha2).join(", ");
10+
var list = CountryCode.values.map<String>((c) => c.alpha2).join(', ');
1111
print(list);
1212

1313
// You can statically access countries by alpha-2, alpha-3, or numeric code
1414
// That's also helpful to get other ISO codes for known code
15-
print(CountryCode.ofAlpha("US").alpha2); // -> US
16-
print(CountryCode.ofAlpha("USA").alpha2); // -> US
15+
print(CountryCode.ofAlpha('US').alpha2); // -> US
16+
print(CountryCode.ofAlpha('USA').alpha2); // -> US
1717
print(CountryCode.ofNumeric(840).alpha2); // -> US
1818

1919
// Always same values for the same country code is returned
20-
print(identical(CountryCode.ofAlpha("US"), CountryCode.US)); // -> true
20+
print(identical(CountryCode.ofAlpha('US'), CountryCode.US)); // -> true
2121

2222
// You can also parse alpha-2, alpha-3, or numeric code
23-
print(CountryCode.parse("US").alpha2); // -> US
24-
print(CountryCode.parse("USA").alpha2); // -> US
25-
print(CountryCode.parse("840").alpha2); // -> US
23+
print(CountryCode.parse('US').alpha2); // -> US
24+
print(CountryCode.parse('USA').alpha2); // -> US
25+
print(CountryCode.parse('840').alpha2); // -> US
2626
}

example/user_example.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ void main() {
44
CountryCode c1, c2, c3, c4, c5;
55

66
// Create values with custom codes (From ISO defined code range)
7-
c1 = CountryCode.user(alpha2: "AA");
7+
c1 = CountryCode.user(alpha2: 'AA');
88
print(c1.alpha2); // -> AA
9-
print(c1.alpha3); // ->
9+
print(c1.alpha3); // ->
1010
print(c1.numeric); // -> 0
11-
11+
1212
// Country values for the same code are equal, but not the same object
13-
c1 = CountryCode.user(alpha3: "XAA");
14-
c2 = CountryCode.user(alpha3: "XAA");
13+
c1 = CountryCode.user(alpha3: 'XAA');
14+
c2 = CountryCode.user(alpha3: 'XAA');
1515
print(c1 == c2); // -> true
1616
print(identical(c1, c2)); // -> false
1717

18-
// You need to assign country code using static method assign(),
18+
// You need to assign country code using static method assign(),
1919
// to be able to use parsing and static accessors for the code.
20-
int index = CountryCode.assign(alpha3: "XAA", numeric: 901);
20+
var index = CountryCode.assign(alpha3: 'XAA', numeric: 901);
2121
print(index); // -> 0
2222
print(CountryCode.userValues); // -> [Country.XXA]
2323

2424
c1 = CountryCode.userValues[index];
25-
c2 = CountryCode.ofAlpha("XAA");
25+
c2 = CountryCode.ofAlpha('XAA');
2626
c3 = CountryCode.ofNumeric(901);
27-
c4 = CountryCode.parse("XAA");
28-
c5 = CountryCode.parse("901");
27+
c4 = CountryCode.parse('XAA');
28+
c5 = CountryCode.parse('901');
2929

3030
print(identical(c1, c2)); // -> true
3131
print(identical(c2, c3)); // -> true
@@ -36,7 +36,6 @@ void main() {
3636
CountryCode.unassignAll();
3737
print(CountryCode.userValues.length); // -> 0
3838

39-
// Now you can not parse or get value for the code 'XAA'
40-
print(CountryCode.tryParse("XAA")); // - null
41-
39+
// Now you can not parse or get value for the code 'XAA'
40+
print(CountryCode.tryParse('XAA')); // - null
4241
}

0 commit comments

Comments
 (0)