isNotNullConstraintError method

bool isNotNullConstraintError([
  1. String? field
])
inherited

True if the exception is a not null constraint error

Implementation

bool isNotNullConstraintError([String? field]) {
  if (_message != null) {
    var expected = 'NOT NULL constraint failed: ';
    if (field != null) {
      expected += field;
    }
    return _message.toLowerCase().contains(expected.toLowerCase());
  }
  return false;
}