From f996dcdc0e8eb152e853a3c659c28ee129be44fe Mon Sep 17 00:00:00 2001 From: Tim Smart Date: Mon, 27 Feb 2023 10:31:48 +1300 Subject: [PATCH] chore: update examples and fix lint warnings --- example/analysis_options.yaml | 2 + example/json_serializable/lib/user.g.dart | 7 +- example/json_serializable/pubspec.lock | 102 ++++++++---------- example/json_serializable/pubspec.yaml | 4 +- example/managing_imports/lib/functional.dart | 3 + .../lib/src/fpdart/location_failure.dart | 8 +- .../fpdart/open_meteo_api_client_fpdart.dart | 3 +- .../lib/src/fpdart/weather_failure.dart | 8 +- example/open_meteo_api/pubspec.lock | 8 +- example/open_meteo_api/pubspec.yaml | 2 +- .../open_meteo_api_client_test_fpdart.dart | 2 +- example/pokeapi_functional/pubspec.lock | 16 +-- .../src/option/nullable/option_nullable.dart | 2 +- example/src/task_either/overview.dart | 1 + 14 files changed, 88 insertions(+), 80 deletions(-) diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 77b2be3e..908c9c5e 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1,4 +1,6 @@ analyzer: + exclude: + - '**/*.g.dart' language: strict-casts: true strict-inference: true diff --git a/example/json_serializable/lib/user.g.dart b/example/json_serializable/lib/user.g.dart index accf917e..8dcff79f 100644 --- a/example/json_serializable/lib/user.g.dart +++ b/example/json_serializable/lib/user.g.dart @@ -7,9 +7,10 @@ part of 'user.dart'; // ************************************************************************** User _$UserFromJson(Map json) => User( - id: Option.fromJson(json['id']), - birthDate: Option.fromJson(json['birthDate']), - phone: Option.fromJson(json['phone']), + id: Option.fromJson(json['id'], (value) => value as int), + birthDate: Option.fromJson( + json['birthDate'], (value) => DateTime.parse(value as String)), + phone: Option.fromJson(json['phone'], (value) => value as String), ); Map _$UserToJson(User instance) => { diff --git a/example/json_serializable/pubspec.lock b/example/json_serializable/pubspec.lock index 119888b8..cf2f85ed 100644 --- a/example/json_serializable/pubspec.lock +++ b/example/json_serializable/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "4826f97faae3af9761f26c52e56b2aa5ffd18d2c1721d984ad85137721c25f43" + sha256: e440ac42679dfc04bbbefb58ed225c994bc7e07fccc8a68ec7d3631a127e5da9 url: "https://pub.dev" source: hosted - version: "31.0.0" + version: "54.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "7337610c3f9cd13e6b7c6bb0f410644091cf63c9a1436e73352a70f3286abb03" + sha256: "2c2e3721ee9fb36de92faa060f3480c81b23e904352b087e5c64224b1a044427" url: "https://pub.dev" source: hosted - version: "2.8.0" + version: "5.6.0" args: dependency: transitive description: @@ -53,42 +53,42 @@ packages: dependency: transitive description: name: build_config - sha256: ad77deb6e9c143a3f550fbb4c5c1e0c6aadabe24274898d06b9526c61b9cf4fb + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" build_resolvers: dependency: transitive description: name: build_resolvers - sha256: "4666aef1d045c5ca15ebba63e400bd4e4fbd9f0dd06e791b51ab210da78a27f7" + sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95 url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.2.0" build_runner: dependency: "direct dev" description: name: build_runner - sha256: "361d73f37cd48c47a81a61421eb1cc4cfd2324516fbb52f1bc4c9a01834ef2de" + sha256: a3335cae313ea41f193e5637f98185e5cb37b3fde2c5c4654ac546b8164e59ac url: "https://pub.dev" source: hosted - version: "2.1.11" + version: "2.4.0" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "0db1b64c84fa803603fa406f8721959036e898cc9575d6ce4a3067581b9276c0" + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" url: "https://pub.dev" source: hosted - version: "7.2.2" + version: "7.2.7" built_collection: dependency: transitive description: @@ -109,18 +109,10 @@ packages: dependency: transitive description: name: checked_yaml - sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659 + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" url: "https://pub.dev" source: hosted - version: "2.0.1" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" - url: "https://pub.dev" - source: hosted - version: "0.3.5" + version: "2.0.2" code_builder: dependency: transitive description: @@ -149,10 +141,10 @@ packages: dependency: transitive description: name: coverage - sha256: "17cf9a839208acaed741b1f00ac87cd1fde00548198ba57205cca45c749cb379" + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.6.3" crypto: dependency: transitive description: @@ -165,10 +157,10 @@ packages: dependency: transitive description: name: dart_style - sha256: "6e8086e1d3c2f6bc15056ee248c4ddc48c2bc71287c0961bf801a08633ed4333" + sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.4" file: dependency: transitive description: @@ -196,10 +188,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "4f4a162323c86ffc1245765cfe138872b8f069deb42f7dbb36115fa27f31469b" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "3.2.0" glob: dependency: transitive description: @@ -252,26 +244,26 @@ packages: dependency: "direct dev" description: name: json_annotation - sha256: "0aa7409f6c82acfab96853b8b0c7503de49918cbe705a57cfdeb477756b4521b" + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.8.0" json_serializable: dependency: "direct main" description: name: json_serializable - sha256: "4af8658055786907c7cecb7fc207b00995fb81201c59542ef6378fc92304cc1c" + sha256: dadc08bd61f72559f938dd08ec20dbfec6c709bba83515085ea943d2078d187a url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "6.6.1" lint: dependency: "direct dev" description: name: lint - sha256: "4a539aa34ec5721a2c7574ae2ca0336738ea4adc2a34887d54b7596310b33c85" + sha256: "3e9343b1cededcfb1e8b40d0dbd3592b7a1c6c0121545663a991433390c2bc97" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "2.0.1" logging: dependency: transitive description: @@ -284,10 +276,10 @@ packages: dependency: transitive description: name: matcher - sha256: "2e2c34e631f93410daa3ee3410250eadc77ac6befc02a040eda8a123f34e6f5a" + sha256: c94db23593b89766cda57aab9ac311e3616cf87c6fa4e9749df032f66f30dcb8 url: "https://pub.dev" source: hosted - version: "0.12.11" + version: "0.12.14" meta: dependency: transitive description: @@ -348,10 +340,10 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: "0e01f805457ef610ccaf8d18067596afc34107a27149778b06b2083edbc140c1" + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" shelf: dependency: transitive description: @@ -388,18 +380,18 @@ packages: dependency: transitive description: name: source_gen - sha256: "00f8b6b586f724a8c769c96f1d517511a41661c0aede644544d8d86a1ab11142" + sha256: c2bea18c95cfa0276a366270afaa2850b09b4a76db95d546f3d003dcc7011298 url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.2.7" source_helper: dependency: transitive description: name: source_helper - sha256: "522d9b05c40ec14f479ce4428337d106c0465fedab42f514582c198460a784fe" + sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" source_map_stack_trace: dependency: transitive description: @@ -468,34 +460,34 @@ packages: dependency: "direct dev" description: name: test - sha256: "5f59ad7ae322905b1299ef250744e1e266320aa90a0a76e51f00b6e06e49ac51" + sha256: "5301f54eb6fe945daa99bc8df6ece3f88b5ceaa6f996f250efdaaf63e22886be" url: "https://pub.dev" source: hosted - version: "1.20.2" + version: "1.23.1" test_api: dependency: transitive description: name: test_api - sha256: d8ca35bbbeef2d037e5693a3c8a381505afebfbfee7bc33fff5581bc4e16a939 + sha256: "6182294da5abf431177fccc1ee02401f6df30f766bc6130a0852c6b6d7ee6b2d" url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.4.18" test_core: dependency: transitive description: name: test_core - sha256: cc8bc45cbe52e8133293537ac4cffc4d9b35c93e91481eb64ef2304e2e722949 + sha256: d2e9240594b409565524802b84b7b39341da36dd6fd8e1660b53ad928ec3e9af url: "https://pub.dev" source: hosted - version: "0.4.11" + version: "0.4.24" timing: dependency: transitive description: name: timing - sha256: c386d07d7f5efc613479a7c4d9d64b03710b03cfaa7e8ad5f2bfb295a1f0dfad + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.1" typed_data: dependency: transitive description: @@ -508,10 +500,10 @@ packages: dependency: transitive description: name: vm_service - sha256: e686ae49284939abc06972e25f634ccdb5007d5664c4dfa1995002e8b6aa27a9 + sha256: f24bfb5ea0b015205e583dda73d67de44785d583ad0889929deaff3a32359ff5 url: "https://pub.dev" source: hosted - version: "8.3.0" + version: "11.1.0" watcher: dependency: transitive description: @@ -545,4 +537,4 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.19.0 <4.0.0" + dart: ">=3.0.0-134.0.dev <4.0.0" diff --git a/example/json_serializable/pubspec.yaml b/example/json_serializable/pubspec.yaml index aa8d7649..96f79033 100644 --- a/example/json_serializable/pubspec.yaml +++ b/example/json_serializable/pubspec.yaml @@ -10,12 +10,12 @@ environment: sdk: '>=2.13.0 <3.0.0' dependencies: - json_serializable: ^5.0.0 + json_serializable: ^6.6.1 fpdart: path: ../../. dev_dependencies: test: ^1.17.5 - lint: ^1.5.3 + lint: ^2.0.1 json_annotation: ^4.1.0 build_runner: ^2.0.6 \ No newline at end of file diff --git a/example/managing_imports/lib/functional.dart b/example/managing_imports/lib/functional.dart index 9ffe5d78..59a6ec5b 100644 --- a/example/managing_imports/lib/functional.dart +++ b/example/managing_imports/lib/functional.dart @@ -1,6 +1,9 @@ +// ignore_for_file: dangling_library_doc_comments + /// This file is used to export all the functional programming libraries used in /// the project. It also exports the `FpState` type alias, which is used to /// avoid conflicts with the `State` class from the Flutter SDK. + import 'package:fpdart/fpdart.dart' as fpdart show State; // The `fpdart` library is used to create functional programming constructs. diff --git a/example/open_meteo_api/lib/src/fpdart/location_failure.dart b/example/open_meteo_api/lib/src/fpdart/location_failure.dart index b428044b..911d772b 100644 --- a/example/open_meteo_api/lib/src/fpdart/location_failure.dart +++ b/example/open_meteo_api/lib/src/fpdart/location_failure.dart @@ -1,3 +1,5 @@ +// ignore_for_file: comment_references + import 'package:http/http.dart' as http; /// Abstract class which represents a failure in the `locationSearch` request. @@ -27,7 +29,8 @@ class LocationInvalidJsonDecodeFpdartFailure final String body; } -/// [OpenMeteoApiFpdartLocationFailure] when location response is not a valid [Map]. +/// [OpenMeteoApiFpdartLocationFailure] when location response is not a valid +/// [Map]. class LocationInvalidMapFpdartFailure implements OpenMeteoApiFpdartLocationFailure { const LocationInvalidMapFpdartFailure(this.json); @@ -39,7 +42,8 @@ class LocationInvalidMapFpdartFailure class LocationKeyNotFoundFpdartFailure implements OpenMeteoApiFpdartLocationFailure {} -/// [OpenMeteoApiFpdartLocationFailure] when location data is not a valid [List]. +/// [OpenMeteoApiFpdartLocationFailure] when location data is not a valid +/// [List]. class LocationInvalidListFpdartFailure implements OpenMeteoApiFpdartLocationFailure { const LocationInvalidListFpdartFailure(this.value); diff --git a/example/open_meteo_api/lib/src/fpdart/open_meteo_api_client_fpdart.dart b/example/open_meteo_api/lib/src/fpdart/open_meteo_api_client_fpdart.dart index 161ae0df..f823f88f 100644 --- a/example/open_meteo_api/lib/src/fpdart/open_meteo_api_client_fpdart.dart +++ b/example/open_meteo_api/lib/src/fpdart/open_meteo_api_client_fpdart.dart @@ -17,7 +17,8 @@ class OpenMeteoApiClientFpdart { /// Finds a [Location] `/v1/search/?name=(query)`. TaskEither locationSearch( - String query) => + String query, + ) => TaskEither.tryCatch( () => _httpClient.get( Uri.https( diff --git a/example/open_meteo_api/lib/src/fpdart/weather_failure.dart b/example/open_meteo_api/lib/src/fpdart/weather_failure.dart index a6cbbcd4..8d923bbc 100644 --- a/example/open_meteo_api/lib/src/fpdart/weather_failure.dart +++ b/example/open_meteo_api/lib/src/fpdart/weather_failure.dart @@ -1,3 +1,5 @@ +// ignore_for_file: comment_references + import 'package:http/http.dart' as http; /// Abstract class which represents a failure in the `getWeather` request. @@ -17,7 +19,8 @@ class WeatherRequestFpdartFailure implements OpenMeteoApiFpdartWeatherFailure { final http.Response response; } -/// [OpenMeteoApiFpdartWeatherFailure] when weather response is not a valid [Map]. +/// [OpenMeteoApiFpdartWeatherFailure] when weather response is not a valid +/// [Map]. class WeatherInvalidMapFpdartFailure implements OpenMeteoApiFpdartWeatherFailure { const WeatherInvalidMapFpdartFailure(this.body); @@ -41,7 +44,8 @@ class WeatherInvalidListFpdartFailure class WeatherDataNotFoundFpdartFailure implements OpenMeteoApiFpdartWeatherFailure {} -/// [OpenMeteoApiFpdartWeatherFailure] when the response is not a valid [Weather] +/// [OpenMeteoApiFpdartWeatherFailure] when the response is not a valid +/// [Weather]. class WeatherFormattingFpdartFailure implements OpenMeteoApiFpdartWeatherFailure { const WeatherFormattingFpdartFailure(this.object, this.stackTrace); diff --git a/example/open_meteo_api/pubspec.lock b/example/open_meteo_api/pubspec.lock index 7b8e68ef..292fb69d 100644 --- a/example/open_meteo_api/pubspec.lock +++ b/example/open_meteo_api/pubspec.lock @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" build_resolvers: dependency: transitive description: @@ -508,10 +508,10 @@ packages: dependency: "direct dev" description: name: very_good_analysis - sha256: "4815adc7ded57657038d2bb2a7f332c50e3c8152f7d3c6acf8f6b7c0cc81e5e2" + sha256: ebc48c51db35beeeec8c414e32f7bd78e612bd7f5992ccb0d46e19edaeb40b08 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0+1" vm_service: dependency: transitive description: diff --git a/example/open_meteo_api/pubspec.yaml b/example/open_meteo_api/pubspec.yaml index a8f88e64..0d7a0f23 100644 --- a/example/open_meteo_api/pubspec.yaml +++ b/example/open_meteo_api/pubspec.yaml @@ -18,4 +18,4 @@ dev_dependencies: json_serializable: ^6.3.1 mocktail: ^0.3.0 test: ^1.16.4 - very_good_analysis: ^3.0.2 + very_good_analysis: ^4.0.0+1 diff --git a/example/open_meteo_api/test/open_meteo_api_client_test_fpdart.dart b/example/open_meteo_api/test/open_meteo_api_client_test_fpdart.dart index 207867bd..1cc346e4 100644 --- a/example/open_meteo_api/test/open_meteo_api_client_test_fpdart.dart +++ b/example/open_meteo_api/test/open_meteo_api_client_test_fpdart.dart @@ -1,4 +1,4 @@ -// ignore_for_file: prefer_const_constructors +// ignore_for_file: prefer_const_constructors, lines_longer_than_80_chars import 'package:fpdart/fpdart.dart'; import 'package:http/http.dart' as http; import 'package:mocktail/mocktail.dart'; diff --git a/example/pokeapi_functional/pubspec.lock b/example/pokeapi_functional/pubspec.lock index a88332a6..344e9c8a 100644 --- a/example/pokeapi_functional/pubspec.lock +++ b/example/pokeapi_functional/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -149,10 +149,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" convert: dependency: transitive description: @@ -318,10 +318,10 @@ packages: dependency: transitive description: name: js - sha256: "323b7c70073cccf6b9b8d8b334be418a3293cfb612a560dc2737160a37bf61bd" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.6" + version: "0.6.7" json_annotation: dependency: transitive description: @@ -358,10 +358,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "12307e7f0605ce3da64cf0db90e5fcab0869f3ca03f76be6bb2991ce0a55e82b" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.0" mime: dependency: transitive description: diff --git a/example/src/option/nullable/option_nullable.dart b/example/src/option/nullable/option_nullable.dart index 5a2072af..fef3765b 100644 --- a/example/src/option/nullable/option_nullable.dart +++ b/example/src/option/nullable/option_nullable.dart @@ -1,4 +1,4 @@ -// ignore_for_file: unchecked_use_of_nullable_value, undefined_getter +// ignore_for_file: unchecked_use_of_nullable_value, undefined_getter, unnecessary_null_comparison import 'package:fpdart/fpdart.dart'; import 'package:glados/glados.dart'; diff --git a/example/src/task_either/overview.dart b/example/src/task_either/overview.dart index 0a20cec8..5a7128dd 100644 --- a/example/src/task_either/overview.dart +++ b/example/src/task_either/overview.dart @@ -24,6 +24,7 @@ Future asyncI() { .catchError( (dynamic error) { print(error); + return 0; }, ); }