defaultBindingHandler function

int defaultBindingHandler(
  1. Statement stmt,
  2. dynamic value,
  3. int index
)

The default argument binder.

defaultBindingHandler support a few type that can be translate or convert into a datatype that supported by SQLite below is the support Dart type that can be convert into SQLite supported type.

  1. NULL
  2. bool
  3. int
  4. double
  5. String
  6. Uint8List
  7. DateTime
  8. Uri
  9. Duration
  10. num
  11. RegExp
  12. Argument

Implementation

int defaultBindingHandler(Statement stmt, dynamic value, int index) {
  if (value is bool?) return bindBool(stmt, value, index);
  if (value is int?) return bindInt(stmt, value, index);
  if (value is double?) return bindDouble(stmt, value, index);
  if (value is String?) return bindString(stmt, value, index);
  if (value is Uint8List?) return bindBlob(stmt, value, index);
  if (value is DateTime?) return bindDateTime(stmt, value, index);
  if (value is Uri?) return bindUri(stmt, value, index);
  if (value is Duration?) return bindDuration(stmt, value, index);
  if (value is RegExp?) return bindRegExp(stmt, value, index);
  // not supported
  throw sql.DatabaseException('Unsupported binding value $value. Try implement Argument instead.');
}