Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ The ODM allows data schemas to be defined which represent the data structure of
- 🎯 Data selectors to help avoid unnecessary Widget rebuilds.
- 💻 Full API code completion.

## Compatibility

- **Freezed**: Compatible with Freezed 3.0.0 and above
- **Analyzer**: Supports analyzer 7.0.0 and above
- **Source Gen**: Compatible with source_gen 2.0.0 and above

## Installation

### 1. Use a recent Dart version
Expand All @@ -34,7 +40,7 @@ That is done by adding the following to your `pubspec.yaml`:

```yaml
environment:
sdk: ">=2.18.0 <4.0.0"
sdk: ">=3.8.0 <4.0.0"
```

### 2. FlutterFire Initialization
Expand Down Expand Up @@ -104,6 +110,24 @@ class MyModel {...}

Once installed, read the documentation on [defining models](./docs/defining-models.md).


## Development
### Testing
To run tests, you should have chromedriver install on your system.
```shell
./scripts/run-tests.sh
```
Note: make sure in `packages/cloud_firestore_odm_generator/pubspec.yaml` to replace
```
cloud_firestore_odm: {VERSION}
```
with
```
cloud_firestore_odm:
path: ../cloud_firestore_odm
```
This is required for the tests to run. Set back to correct version before deploying.
Comment on lines +120 to +129

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This manual step of modifying pubspec.yaml for local testing is error-prone, as a developer might forget to revert the changes before creating a pull request or publishing. This could lead to a broken release with a local path dependency. Consider automating this with a script or using a more robust solution for managing local dependencies in a monorepo, such as Melos, to mitigate this risk.


## Issues and feedback

Please file FlutterFire specific issues, bugs, or feature requests in our [issue tracker](https://github.com/firebaseextended/firestoreodm-flutter/issues/new).
Expand Down
7 changes: 4 additions & 3 deletions docs/code-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ generated code:
dart run build_runner watch --delete-conflicting-outputs
```

This will generate files with the postfix of `.g.dart`, corresponding to the
This will generate files with the postfix of `.firebase.dart`, corresponding to the
file name of your model. For example:

- A model is defined within a file named `product.dart`.
- Code generation will create a file in the same directory named `product.g.dart`.
- Within the `product.dart` file, apply the part declaration (`part 'product.g.dart'`).
- Code generation will create a file in the same directory named `product.firebase.dart`.
- Within the `product.dart` file, apply the part declaration (`part 'product.firebase.dart'`).
- You should also have a `.g.dart` for the json serilizer (`part 'product.g.dart'`).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo here. It should be serializer.

Suggested change
- You should also have a `.g.dart` for the json serilizer (`part 'product.g.dart'`).
- You should also have a `.g.dart` for the json serializer (`part 'product.g.dart'`).


## Next steps

Expand Down
1 change: 1 addition & 0 deletions docs/defining-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:cloud_firestore_odm/cloud_firestore_odm.dart';

// This doesn't exist yet...! See "Next Steps"
part 'user.firebase.dart';
part 'user.g.dart';

/// A custom JsonSerializable annotation that supports decoding objects such
Expand Down
15 changes: 15 additions & 0 deletions packages/cloud_firestore_odm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 2.0.0
- **BREAKING**: Must include a "part '<FILENAME>.firebase.dart';" instead of just part "'<FILENAME>.g.dart';". This is because of compatibilty with Riverpod ^3.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo here. It should be compatibility.

Suggested change
- **BREAKING**: Must include a "part '<FILENAME>.firebase.dart';" instead of just part "'<FILENAME>.g.dart';". This is because of compatibilty with Riverpod ^3.
- **BREAKING**: Must include a "part '<FILENAME>.firebase.dart';" instead of just part "'<FILENAME>.g.dart';". This is because of compatibility with Riverpod ^3.


## 1.3.0
- **CHORE**: upgraded packages to support analyzer ^8 and min sdk to 3.8.0

## 1.2.0
- **CHORE**: Update cloud_firestore to ^6.0.0

## 1.1.0

- **FIX**: Resolve compatibility issues with Freezed 3.0.0 and above
- **FEAT**: Support analyzer 7.0.0 and above
- **CHORE**: Update dependencies to latest versions

## 1.0.0-dev.88

- **BREAKING**: Removes `set` methods from `FirestoreDocumentReference` to make way for generated methods
Expand Down
6 changes: 6 additions & 0 deletions packages/cloud_firestore_odm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ To learn more about Firebase Cloud Firestore, please visit the [Firebase website

[![pub package](https://img.shields.io/pub/v/cloud_firestore_odm.svg)](https://pub.dev/packages/cloud_firestore_odm)

## Compatibility

- **Freezed**: Compatible with Freezed 3.0.0 and above
- **Analyzer**: Supports analyzer 7.0.0 and above
- **Source Gen**: Compatible with source_gen 2.0.0 and above

## Getting Started

To get started with Cloud Firestore for Flutter, please [see the documentation](https://github.com/firebaseextended/firestoreodm-flutter/tree/main/docs).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import 'package:integration_test/integration_test.dart';

import 'collection_reference_test.dart' as collection_reference_test;
import 'document_reference_test.dart' as document_reference_test;

import 'firebase_options.dart';

import 'freezed_test.dart' as freezed_test;
import 'path_test.dart' as path_test;
import 'query_reference_test.dart' as query_reference_test;

Expand All @@ -32,5 +31,6 @@ void main() {
// firestore_builder_test.main();
query_reference_test.main();
path_test.main();
freezed_test.main();
});
}
Loading