Skip to content

Commit

Permalink
Update dart
Browse files Browse the repository at this point in the history
  • Loading branch information
passsy committed Aug 30, 2024
1 parent 547e0ce commit c191c0a
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 44 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,37 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: pub get --no-precompile
run: dart pub get || pub get
- name: Run tests
run: pub run test

formatting:
runs-on: ubuntu-latest

container:
image: google/dart:3.5
image: dart:3.5

steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: pub get --no-precompile
run: dart pub get
- name: check formatting
run: dart format --fix --set-exit-if-changed .

lint:
runs-on: ubuntu-latest

container:
image: google/dart:3.5
image: dart:3.5

steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: pub get --no-precompile
run: dart pub get
- name: lint
run: dart analyze --fatal-infos
- name: docs
run: dartdoc .
- name: Verify package completness
run: pub publish -n
run: dart doc .
- name: Verify package completeness
run: dart pub publish -n

2 changes: 1 addition & 1 deletion example/deep_pick_example.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: avoid_print, always_require_non_null_named_parameters, non_constant_identifier_names, omit_local_variable_types, avoid_dynamic_calls
// ignore_for_file: avoid_print, always_require_non_null_named_parameters, non_constant_identifier_names, omit_local_variable_types, avoid_dynamic_calls, unreachable_from_main
import 'dart:convert';

import 'package:deep_pick/deep_pick.dart';
Expand Down
10 changes: 5 additions & 5 deletions test/src/pick_datetime_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asDateTimeOrNull() when the value may be null/absent at some point (DateTime?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asDateTimeOrNull() when the value may be null/absent at some point (DateTime?).',
],
),
),
Expand All @@ -42,7 +42,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as DateTime'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as DateTime',
],
),
),
Expand Down Expand Up @@ -99,7 +99,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.',
],
),
),
Expand All @@ -112,7 +112,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as DateTime'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as DateTime',
],
),
),
Expand Down Expand Up @@ -685,7 +685,7 @@ void main() {
pickException(
containing: [
'Type String of picked value "Mon, 11 Nov 24 11:58:15 ESTX"',
'Unknown time zone abbrevation ESTX'
'Unknown time zone abbrevation ESTX',
],
),
),
Expand Down
8 changes: 4 additions & 4 deletions test/src/pick_double_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asDoubleOrNull() when the value may be null/absent at some point (double?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asDoubleOrNull() when the value may be null/absent at some point (double?).',
],
),
),
Expand All @@ -54,7 +54,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as double'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as double',
],
),
),
Expand Down Expand Up @@ -122,7 +122,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.',
],
),
),
Expand All @@ -135,7 +135,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as double'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as double',
],
),
),
Expand Down
10 changes: 5 additions & 5 deletions test/src/pick_int_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void main() {
throwsA(
pickException(
containing: [
'[roundDouble] and [truncateDouble] can not be true at the same time'
'[roundDouble] and [truncateDouble] can not be true at the same time',
],
),
),
Expand All @@ -45,7 +45,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asIntOrNull() when the value may be null/absent at some point (int?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asIntOrNull() when the value may be null/absent at some point (int?).',
],
),
),
Expand All @@ -58,7 +58,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as int'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as int',
],
),
),
Expand Down Expand Up @@ -104,7 +104,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.',
],
),
),
Expand All @@ -117,7 +117,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as int'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be parsed as int',
],
),
),
Expand Down
8 changes: 4 additions & 4 deletions test/src/pick_let_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent.'
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent.',
],
),
),
Expand All @@ -65,7 +65,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent.'
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent.',
],
),
),
Expand All @@ -82,7 +82,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use letOrNull() when the value may be null/absent at some point.'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use letOrNull() when the value may be null/absent at some point.',
],
),
),
Expand All @@ -93,7 +93,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent. Use letOrNull() when the value may be null/absent at some point'
'Expected a non-null value but location "name" in pick(json, "name" (absent)) is absent. Use letOrNull() when the value may be null/absent at some point',
],
),
),
Expand Down
10 changes: 5 additions & 5 deletions test/src/pick_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asListOrEmpty()/asListOrNull() when the value may be null/absent at some point (List<String>?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asListOrEmpty()/asListOrNull() when the value may be null/absent at some point (List<String>?).',
],
),
),
Expand Down Expand Up @@ -88,7 +88,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent. Use asListOrEmpty()/asListOrNull() when the value may be null/absent at some point (List<Person>?).'
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent. Use asListOrEmpty()/asListOrNull() when the value may be null/absent at some point (List<Person>?).',
],
),
),
Expand All @@ -109,7 +109,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be casted to List<dynamic>'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be casted to List<dynamic>',
],
),
),
Expand Down Expand Up @@ -202,7 +202,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent.'
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent.',
],
),
),
Expand Down Expand Up @@ -306,7 +306,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent.'
'Expected a non-null value but location list index 1 in pick(json, 1 (absent), "name") is absent.',
],
),
),
Expand Down
8 changes: 4 additions & 4 deletions test/src/pick_map_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asMapOrEmpty()/asMapOrNull() when the value may be null/absent at some point (Map<String, bool>?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asMapOrEmpty()/asMapOrNull() when the value may be null/absent at some point (Map<String, bool>?).',
],
),
),
Expand All @@ -25,7 +25,7 @@ void main() {

test('throws for cast error', () {
final dynamic data = {
'a': {'some': 'value'}
'a': {'some': 'value'},
};

try {
Expand Down Expand Up @@ -63,7 +63,7 @@ void main() {
throwsA(
pickException(
containing: [
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be casted to Map<dynamic, dynamic>'
'Type Object of picked value "Instance of \'Object\'" using pick(<root>) can not be casted to Map<dynamic, dynamic>',
],
),
),
Expand All @@ -86,7 +86,7 @@ void main() {

test('reports errors correctly', () {
final dynamic data = {
'a': {'some': 'value'}
'a': {'some': 'value'},
};

try {
Expand Down
4 changes: 2 additions & 2 deletions test/src/pick_string_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asStringOrNull() when the value may be null/absent at some point (String?).'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent. Use asStringOrNull() when the value may be null/absent at some point (String?).',
],
),
),
Expand Down Expand Up @@ -74,7 +74,7 @@ void main() {
throwsA(
pickException(
containing: [
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.'
'Expected a non-null value but location "unknownKey" in pick(json, "unknownKey" (absent)) is absent.',
],
),
),
Expand Down
12 changes: 7 additions & 5 deletions test/src/pick_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: unreachable_from_main

import 'package:deep_pick/deep_pick.dart';
import 'package:test/test.dart';

Expand All @@ -12,7 +14,7 @@ void main() {

test('pick a value with two args', () {
final data = {
'name': {'first': 'John', 'last': 'Snow'}
'name': {'first': 'John', 'last': 'Snow'},
};
final p = pick(data, 'name', 'first');
expect(p.value, 'John');
Expand All @@ -21,7 +23,7 @@ void main() {

test('ignores null args', () {
final data = {
'name': {'first': 'John', 'last': 'Snow'}
'name': {'first': 'John', 'last': 'Snow'},
};
// Probably nobody is using it that way. It's a byproduct of faking varargs.
// But it is the public API and shouldn't break
Expand All @@ -41,7 +43,7 @@ void main() {

test('pickDeep a value with two args', () {
final data = {
'name': {'first': 'John', 'last': 'Snow'}
'name': {'first': 'John', 'last': 'Snow'},
};
final p = pickDeep(data, ['name', 'first']);
expect(p.value, 'John');
Expand Down Expand Up @@ -295,7 +297,7 @@ void main() {

test('is not absent, not null, further down', () {
final json = {
'a': {'b': 1}
'a': {'b': 1},
};
final p = pick(json, 'a', 'x' /*absent*/);
expect(p.value, isNull);
Expand Down Expand Up @@ -393,7 +395,7 @@ void main() {
final contexts = root.asListOrNull((pick) => pick.context);
expect(contexts, [
{'lang': 'de'},
{'lang': 'de'}
{'lang': 'de'},
]);
});

Expand Down
2 changes: 1 addition & 1 deletion test/src/required_pick_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void main() {
final contexts = root.asListOrEmpty((pick) => pick.context);
expect(contexts, [
{'lang': 'de'},
{'lang': 'de'}
{'lang': 'de'},
]);
});

Expand Down

0 comments on commit c191c0a

Please sign in to comment.