jaguar_orm
jaguar_orm copied to clipboard
Feature request - support Optional data type
When creating the model it would be great to have nullable columns handled with the Optional so nullability becomes explicit and null checks can be removed from the code.
import 'package:optional/optional.dart';
class NullableClass extends Equatable {
@Column(isNullable: true)
Optional<String> nullableValue;
NullableClass({this.nullableValue}) : super([nullableValue]);
}
Current behaviour is an Exception which is logged in the generate .jorm.dart
files, see issue #127
Another area which Optional could be introduced is in the generated bean's find
Future<Optional<?>> find(int id)
Future<?> get(int id)
Will look into this.
dart will (soon?) have nullable field so it will be better to wait for it and use it once it's there instead of playing around and add an Optional class that will complexify the core code