Docs: Update isNull / isNotNull

This commit is contained in:
Simon Binder 2021-04-25 15:12:55 +02:00
parent 3d6537ccfb
commit df7f1fb051
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 8 additions and 3 deletions

View File

@ -63,9 +63,14 @@ String expressions define a `+` operator as well. Just like you would expect, it
concatenation in sql.
## Nullability
To check whether an expression returns null, you can use the top-level `isNull` function,
which takes any expression and returns a boolean expression. The expression returned will
resolve to `true` if the inner expression resolves to null and `false` otherwise.
To check whether an expression evaluates to `NULL` in sql, you can use the `isNull` extension:
```dart
final withoutCategories = select(todos)..where((row) => row.category.isNull());
```
The expression returned will resolve to `true` if the inner expression resolves to null
and `false` otherwise.
As you would expect, `isNotNull` works the other way around.
To use a fallback value when an expression evaluates to `null`, you can use the `coalesce`