diff --git a/.github/workflows/reusable-dart-analyze-format-test.yaml b/.github/workflows/reusable-dart-analyze-format-test.yaml index 9ad3f072..a622eea2 100644 --- a/.github/workflows/reusable-dart-analyze-format-test.yaml +++ b/.github/workflows/reusable-dart-analyze-format-test.yaml @@ -34,7 +34,10 @@ jobs: - run: dart pub get && dart run melos bootstrap --scope="${{ inputs.package }}" - - run: dart analyze --fatal-infos lib + # TODO: Restore --fatal-infos when analyzer 6.5 is significantly available + # in major versions of Flutter. Likely in Q1 2025 https://github.com/GetDutchie/brick/pull/435 + # - run: dart analyze --fatal-infos lib + - run: dart analyze lib working-directory: packages/${{ inputs.package }} - run: dart format --output=none --line-length 100 --set-exit-if-changed lib test diff --git a/packages/brick_build/CHANGELOG.md b/packages/brick_build/CHANGELOG.md index dadd1163..2ddbe282 100644 --- a/packages/brick_build/CHANGELOG.md +++ b/packages/brick_build/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +## 3.2.1 + +- Revert `.getDisplayString()` change due to Flutter 3.22 being restricted to analyzer <6.4.1. `meta` is pinned to `1.12` in this version of Flutter, and `analyzer >=6.5.0`, where the change was made, requires `meta >= 1.15`. This change will eventually be re-reverted. + ## 3.2.0 - Add convenience mixin `AnnotationFinderWithFieldRename` for field renames in generators diff --git a/packages/brick_build/lib/src/utils/shared_checker.dart b/packages/brick_build/lib/src/utils/shared_checker.dart index b8da7e75..a54c744f 100644 --- a/packages/brick_build/lib/src/utils/shared_checker.dart +++ b/packages/brick_build/lib/src/utils/shared_checker.dart @@ -181,7 +181,7 @@ class SharedChecker<_SiblingModel extends Model> { if (classElement.supertype?.typeArguments == null || classElement.supertype!.typeArguments.isEmpty) { throw InvalidGenerationSourceError( - 'Type argument for ${targetType.getDisplayString()} is undefined.', + 'Type argument for ${targetType.getDisplayString(withNullability: true)} is undefined.', todo: 'Define the type on class ${targetType.element}, e.g. `extends ${withoutNullability(classElement.supertype!)}`', element: targetType.element, @@ -243,7 +243,8 @@ class SharedChecker<_SiblingModel extends Model> { } /// Print the `DartType` without nullability - static String withoutNullability(DartType type) => type.getDisplayString().replaceAll('?', ''); + static String withoutNullability(DartType type) => + type.getDisplayString(withNullability: true).replaceAll('?', ''); /// Destructs a type to determine the bottom type after going through Futures and Iterables. /// diff --git a/packages/brick_build/pubspec.yaml b/packages/brick_build/pubspec.yaml index 96dd9aa2..e168d521 100644 --- a/packages/brick_build/pubspec.yaml +++ b/packages/brick_build/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_build issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.2.0 +version: 3.2.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/brick_json_generators/CHANGELOG.md b/packages/brick_json_generators/CHANGELOG.md index def8bb2a..51e5f28a 100644 --- a/packages/brick_json_generators/CHANGELOG.md +++ b/packages/brick_json_generators/CHANGELOG.md @@ -1,8 +1,9 @@ ## Unreleased - (test) remove analysis options override for non-standard library prefixes +- Revert `.getDisplayString()` change due to Flutter 3.22 being restricted to analyzer <6.4.1. `meta` is pinned to `1.12` in this version of Flutter, and `analyzer >=6.5.0`, where the change was made, requires `meta >= 1.15`. This change will eventually be re-reverted. -## 3.1.0 +## 3.1.1 - Apply standardized lints - Update `analyzer` constraints to `>=6.0.0 <7.0.0` diff --git a/packages/brick_json_generators/lib/json_deserialize.dart b/packages/brick_json_generators/lib/json_deserialize.dart index f52b835c..4bd95aab 100644 --- a/packages/brick_json_generators/lib/json_deserialize.dart +++ b/packages/brick_json_generators/lib/json_deserialize.dart @@ -94,7 +94,7 @@ mixin JsonDeserialize ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString()}) + (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString(withNullability: true)}) )$castIterable$defaultValue'''; } @@ -138,7 +138,7 @@ mixin JsonDeserialize=2.18.0 <4.0.0" diff --git a/packages/brick_offline_first_build/CHANGELOG.md b/packages/brick_offline_first_build/CHANGELOG.md index 9377a796..39aeabaa 100644 --- a/packages/brick_offline_first_build/CHANGELOG.md +++ b/packages/brick_offline_first_build/CHANGELOG.md @@ -1,6 +1,9 @@ ## Unreleased +## 3.2.1 + - (test) remove analysis options override for non-standard library prefixes +- Revert `.getDisplayString()` change due to Flutter 3.22 being restricted to analyzer <6.4.1. `meta` is pinned to `1.12` in this version of Flutter, and `analyzer >=6.5.0`, where the change was made, requires `meta >= 1.15`. This change will eventually be re-reverted. ## 3.2.0 diff --git a/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart b/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart index 49b575d3..922f3844 100644 --- a/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart +++ b/packages/brick_offline_first_build/lib/src/offline_first_json_generators.dart @@ -198,7 +198,8 @@ mixin OfflineFirstJsonDeserialize ${SharedChecker.withoutNullability(checker.argType)}.$constructorName(c as $serializableType))$castIterable$defaultValue'; } diff --git a/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart b/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart index 17f4e257..a3b7528c 100644 --- a/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart +++ b/packages/brick_offline_first_build/lib/src/offline_first_sqlite_generators.dart @@ -91,7 +91,8 @@ class OfflineFirstSqliteDeserialize extends SqliteDeserialize { if (argTypeChecker.hasSerdes) { final doesHaveConstructor = hasConstructor(checker.argType); if (doesHaveConstructor) { - final serializableType = argTypeChecker.superClassTypeArgs.last.getDisplayString(); + final serializableType = + argTypeChecker.superClassTypeArgs.last.getDisplayString(withNullability: true); return ''' jsonDecode($fieldValue).map( (c) => $argType.$constructorName(c as $serializableType) @@ -105,7 +106,8 @@ class OfflineFirstSqliteDeserialize extends SqliteDeserialize { if ((checker as OfflineFirstChecker).hasSerdes) { final doesHaveConstructor = hasConstructor(field.type); if (doesHaveConstructor) { - final serializableType = checker.superClassTypeArgs.last.getDisplayString(); + final serializableType = + checker.superClassTypeArgs.last.getDisplayString(withNullability: true); return '${SharedChecker.withoutNullability(field.type)}.$constructorName($fieldValue as $serializableType)'; } } diff --git a/packages/brick_offline_first_build/pubspec.yaml b/packages/brick_offline_first_build/pubspec.yaml index 73445db4..dfbe4e40 100644 --- a/packages/brick_offline_first_build/pubspec.yaml +++ b/packages/brick_offline_first_build/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_offline_f issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.2.0 +version: 3.2.1 environment: sdk: ">=2.18.0 <4.0.0" diff --git a/packages/brick_offline_first_with_supabase/lib/src/offline_first_with_supabase_repository.dart b/packages/brick_offline_first_with_supabase/lib/src/offline_first_with_supabase_repository.dart index 39223e51..4dcbd4f0 100644 --- a/packages/brick_offline_first_with_supabase/lib/src/offline_first_with_supabase_repository.dart +++ b/packages/brick_offline_first_with_supabase/lib/src/offline_first_with_supabase_repository.dart @@ -86,7 +86,21 @@ abstract class OfflineFirstWithSupabaseRepository required DatabaseFactory databaseFactory, http.Client? innerClient, Duration? processingInterval, - List? reattemptForStatusCodes, + List reattemptForStatusCodes = const [ + 400, + 401, + 403, + 404, + 405, + 408, + 409, + 429, + 500, + 501, + 502, + 503, + 504, + ], bool? serialProcessing, }) { final client = RestOfflineQueueClient( diff --git a/packages/brick_offline_first_with_supabase/pubspec.yaml b/packages/brick_offline_first_with_supabase/pubspec.yaml index f6e1aa1e..a92d9e05 100644 --- a/packages/brick_offline_first_with_supabase/pubspec.yaml +++ b/packages/brick_offline_first_with_supabase/pubspec.yaml @@ -13,8 +13,8 @@ environment: dependencies: brick_core: ^1.1.1 brick_offline_first: ">=3.0.0 <4.0.0" - brick_supabase: ">=0.0.1 <2.0.0" brick_sqlite: ">=3.0.0 <4.0.0" + brick_supabase: ">=0.0.1 <2.0.0" brick_offline_first_with_rest: ">=3.0.2 <4.0.0" http: ">=1.0.0 <2.0.0" logging: ">=1.0.0 <2.0.0" @@ -24,5 +24,6 @@ dependencies: dev_dependencies: lints: ^2.0.1 mockito: ^5.0.0 - test: ^1.16.5 sqflite_common_ffi: ^2.0.0 + supabase: ">=2.3.0 <3.0.0" + test: ^1.16.5 diff --git a/packages/brick_sqlite_generators/CHANGELOG.md b/packages/brick_sqlite_generators/CHANGELOG.md index bc21f647..cfc91ccc 100644 --- a/packages/brick_sqlite_generators/CHANGELOG.md +++ b/packages/brick_sqlite_generators/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +## 3.2.2 + +- Revert `.getDisplayString()` change due to Flutter 3.22 being restricted to analyzer <6.4.1. `meta` is pinned to `1.12` in this version of Flutter, and `analyzer >=6.5.0`, where the change was made, requires `meta >= 1.15`. This change will eventually be re-reverted. + ## 3.2.1 - Use `SharedChecker.withoutNullability` instead of stripping null suffixes manually diff --git a/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart b/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart index 6d66c48f..4d310a50 100644 --- a/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart +++ b/packages/brick_sqlite_generators/lib/src/sqlite_deserialize.dart @@ -137,7 +137,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato final discoveredByIndex = 'jsonDecode($fieldValue).map((d) => d as int > -1 ? ${SharedChecker.withoutNullability(argType)}.values[d] : null)'; final nullableSuffix = checker.isNullable ? '?' : ''; - return '$discoveredByIndex$nullableSuffix.whereType<${argType.getDisplayString()}>()$castIterable'; + return '$discoveredByIndex$nullableSuffix.whereType<${argType.getDisplayString(withNullability: true)}>()$castIterable'; } // Iterable @@ -152,7 +152,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato final nullableSuffix = checker.isNullable ? " ?? '[]'" : ''; return '''jsonDecode($fieldValue$nullableSuffix).map( - (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString()}) + (d) => ${klass.displayName}.fromJson(d as ${parameterType.getDisplayString(withNullability: true)}) )$castIterable$defaultValue'''; } @@ -210,7 +210,7 @@ class SqliteDeserialize<_Model extends SqliteModel> extends SqliteSerdesGenerato } else if (checker.fromJsonConstructor != null) { final klass = checker.targetType.element as ClassElement; final parameterType = checker.fromJsonConstructor!.parameters.first.type; - return '${klass.displayName}.fromJson(jsonDecode($fieldValue as String) as ${parameterType.getDisplayString()})'; + return '${klass.displayName}.fromJson(jsonDecode($fieldValue as String) as ${parameterType.getDisplayString(withNullability: true)})'; } return null; diff --git a/packages/brick_sqlite_generators/pubspec.yaml b/packages/brick_sqlite_generators/pubspec.yaml index 1518c59a..cd047fd7 100644 --- a/packages/brick_sqlite_generators/pubspec.yaml +++ b/packages/brick_sqlite_generators/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/GetDutchie/brick/tree/main/packages/brick_sqlite_ge issue_tracker: https://github.com/GetDutchie/brick/issues repository: https://github.com/GetDutchie/brick -version: 3.2.1 +version: 3.2.2 environment: sdk: ">=2.18.0 <4.0.0"