Skip to content

Commit

Permalink
Merge pull request #32 from kosukesaigusa/flutterfire_gen/v0.4.0
Browse files Browse the repository at this point in the history
Flutterfire gen/v0.4.0
  • Loading branch information
kosukesaigusa authored Jan 7, 2024
2 parents 9bf9f03 + 7f122d9 commit 2640ef3
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 38 deletions.
3 changes: 3 additions & 0 deletions examples/todo/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class _TodoListPageState extends ConsumerState<TodoListPage> {
final count = await ref
.read(todoListProvider.notifier)
.countNotCompletedTodos();
if (count == null) {
return;
}
if (!mounted) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/lib/todo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TodoList extends _$TodoList {
ref.invalidateSelf();
}

Future<int> countNotCompletedTodos() => ref.read(todoQueryProvider).count(
Future<int?> countNotCompletedTodos() => ref.read(todoQueryProvider).count(
queryBuilder: (query) => query.where('isCompleted', isNotEqualTo: true),
);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/lib/todo.flutterfire_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class TodoQuery {
/// - [asCollectionGroup] Count the 'todos' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<Todo>? Function(Query<Todo> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
bool asCollectionGroup = false,
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/lib/todo.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions examples/todo/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,26 @@ packages:
dependency: "direct main"
description:
name: cloud_firestore
sha256: cb978c7512624144f24f3d06e4312b2f4ac00b016f2fed62dc8f6d56b8585d78
sha256: "8bfbb5a2edbc6052452326d60de0113fea2bcbf081d34a3f8e45c8b38307b31c"
url: "https://pub.dev"
source: hosted
version: "4.13.6"
version: "4.14.0"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
sha256: fa177fa85f7665c76e1ebec252a5b280b4b47612b4d70fe286944814fff1d4f2
sha256: "73ff438fe46028f0e19f55da18b6ddc6906ab750562cd7d9ffab77ff8c0c4307"
url: "https://pub.dev"
source: hosted
version: "6.0.10"
version: "6.1.0"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
sha256: d0ebbf0927e627c0d7d2f3177d3b6f0050e5d811c08c2b646b0c746a2b502cb7
sha256: "232e45e95970d3a6baab8f50f9c3a6e2838d145d9d91ec9a7392837c44296397"
url: "https://pub.dev"
source: hosted
version: "3.8.10"
version: "3.9.0"
code_builder:
dependency: transitive
description:
Expand Down Expand Up @@ -326,21 +326,21 @@ packages:
path: "../../packages/flutterfire_gen"
relative: true
source: path
version: "0.3.0-dev.5"
version: "0.4.0"
flutterfire_gen_annotation:
dependency: "direct main"
description:
path: "../../packages/flutterfire_gen_annotation"
relative: true
source: path
version: "0.3.0-dev.1"
version: "0.4.0"
flutterfire_gen_utils:
dependency: "direct main"
description:
path: "../../packages/flutterfire_gen_utils"
relative: true
source: path
version: "0.3.0-dev.2"
version: "0.4.0"
freezed_annotation:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:
flutter: '>=3.10.0'

dependencies:
cloud_firestore: ^4.13.6
cloud_firestore: ^4.14.0
firebase_core: ^2.24.2
flutter:
sdk: flutter
Expand Down
7 changes: 6 additions & 1 deletion packages/flutterfire_gen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased changes
## 0.4.0

> [!NOTE]
> This release has breaking changes.
* **Breaking**: Update `cloud_firestore` package version to `4.14.0`, which is not compatible with its previous version `4.13.6` or lower because of the `count` query return type change. See the `cloud_firestore` package diff [here](https://github.com/firebase/flutterfire/commit/82af6c2f40160a9e2f74e2d48652003fa48bb161#diff-a7d6f2f7fa9f6ad84f9faf884d4a507f5e85a06d88e64b99578de885a0b637d5R19).
* Update `flutterfire_gen`, `flutterfire_gen_utils` dependency versions.
* Refactor `FieldElementParser` to enable to write unit test.
* Add `field_element_parser_test.dart`.
* Add `dart_type_util.dart` tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class TodoQuery {
/// - [asCollectionGroup] Count the 'todos' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<ReadTodo>? Function(Query<ReadTodo> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
bool asCollectionGroup = false,
Expand Down
18 changes: 9 additions & 9 deletions packages/flutterfire_gen/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,26 @@ packages:
dependency: "direct main"
description:
name: cloud_firestore
sha256: cb978c7512624144f24f3d06e4312b2f4ac00b016f2fed62dc8f6d56b8585d78
sha256: "8bfbb5a2edbc6052452326d60de0113fea2bcbf081d34a3f8e45c8b38307b31c"
url: "https://pub.dev"
source: hosted
version: "4.13.6"
version: "4.14.0"
cloud_firestore_platform_interface:
dependency: transitive
description:
name: cloud_firestore_platform_interface
sha256: fa177fa85f7665c76e1ebec252a5b280b4b47612b4d70fe286944814fff1d4f2
sha256: "73ff438fe46028f0e19f55da18b6ddc6906ab750562cd7d9ffab77ff8c0c4307"
url: "https://pub.dev"
source: hosted
version: "6.0.10"
version: "6.1.0"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
sha256: d0ebbf0927e627c0d7d2f3177d3b6f0050e5d811c08c2b646b0c746a2b502cb7
sha256: "232e45e95970d3a6baab8f50f9c3a6e2838d145d9d91ec9a7392837c44296397"
url: "https://pub.dev"
source: hosted
version: "3.8.10"
version: "3.9.0"
code_builder:
dependency: transitive
description:
Expand Down Expand Up @@ -278,21 +278,21 @@ packages:
path: ".."
relative: true
source: path
version: "0.3.0-dev.5"
version: "0.4.0"
flutterfire_gen_annotation:
dependency: "direct main"
description:
path: "../../flutterfire_gen_annotation"
relative: true
source: path
version: "0.3.0-dev.1"
version: "0.4.0"
flutterfire_gen_utils:
dependency: "direct main"
description:
path: "../../flutterfire_gen_utils"
relative: true
source: path
version: "0.3.0-dev.2"
version: "0.4.0"
frontend_server_client:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/flutterfire_gen/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ environment:
flutter: '>=3.10.0'

dependencies:
cloud_firestore: ^4.13.6
cloud_firestore: ^4.14.0
firebase_core: ^2.24.2
flutter:
sdk: flutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ${docCommentTemplate.forClass()}class ${config.baseClassName}Query {
});
}
${docCommentTemplate.forCountMethod()}Future<int> count({
${docCommentTemplate.forCountMethod()}Future<int?> count({
$documentIdMethodParametersDefinition
Query<${config.readClassName}>? Function(Query<${config.readClassName}> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
Expand Down
6 changes: 3 additions & 3 deletions packages/flutterfire_gen/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutterfire_gen
description: flutterfire_gen is a package for automatic code generation for Cloud Firestore. It supports efficient CRUD operations with type-safe interfaces and methods.
version: 0.3.0-dev.5
version: 0.4.0
homepage: https://github.com/kosukesaigusa/flutterfire_gen

environment:
Expand All @@ -9,11 +9,11 @@ environment:
dependencies:
analyzer: ">=5.13.0 <7.0.0"
build: ^2.4.1
cloud_firestore: ^4.13.6
cloud_firestore: ^4.14.0
flutter:
sdk: flutter
flutterfire_gen_annotation: ^0.3.0-dev.1
flutterfire_gen_utils: ^0.3.0-dev.2
flutterfire_gen_utils: ^0.4.0
json_annotation: ^4.8.1
meta: ^1.9.1
path: ^1.8.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class AppUserQuery {
/// - [asCollectionGroup] Count the 'appUsers' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<ReadAppUser>? Function(Query<ReadAppUser> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
bool asCollectionGroup = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class AppUserPostQuery {
/// - [asCollectionGroup] Count the 'appUserPosts' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
required String appUserId,
Query<ReadAppUserPost>? Function(Query<ReadAppUserPost> query)?
queryBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class AppUserPostLikeQuery {
/// - [asCollectionGroup] Count the 'appUserPostLikes' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
required String appUserId,
required String appUserPostId,
Query<ReadAppUserPostLike>? Function(Query<ReadAppUserPostLike> query)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class AppUserPostLikeTaskQuery {
/// - [asCollectionGroup] Count the 'appUserPostLikeTasks' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<ReadAppUserPostLikeTask>? Function(
Query<ReadAppUserPostLikeTask> query)?
queryBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class ChatMessageQuery {
/// - [asCollectionGroup] Count the 'chatMessages' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
required String chatRoomId,
Query<ReadChatMessage>? Function(Query<ReadChatMessage> query)?
queryBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ class EntityQuery {
/// - [asCollectionGroup] Count the 'entities' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<ReadEntity>? Function(Query<ReadEntity> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
bool asCollectionGroup = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class FcmTokenQuery {
/// - [asCollectionGroup] Count the 'fcmTokens' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
Query<ReadFcmToken>? Function(Query<ReadFcmToken> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
bool asCollectionGroup = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class ReadStatusQuery {
/// - [asCollectionGroup] Count the 'readStatuses' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
required String chatRoomId,
Query<ReadReadStatus>? Function(Query<ReadReadStatus> query)? queryBuilder,
AggregateSource source = AggregateSource.server,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class UserActivityQuery {
/// - [asCollectionGroup] Count the 'activities' as a collection group if true.
///
/// Returns the count of documents as an integer.
Future<int> count({
Future<int?> count({
required String userId,
Query<ReadUserActivity>? Function(Query<ReadUserActivity> query)?
queryBuilder,
Expand Down

0 comments on commit 2640ef3

Please sign in to comment.