rawQuery method

Future<SQLiteCursor> rawQuery (String sql, [ List<String> args = const [] ])

Runs the provided SQL and returns a cursor over the result set.

See: https://developer.android.com/reference/android/database/sqlite/SQLiteDatabase#rawQuery(java.lang.String,%20java.lang.String[])

Implementation

Future<SQLiteCursor> rawQuery(final String sql,
    [final List<String> args = const <String>[]]) async {
  final Map<String, dynamic> request = <String, dynamic>{
    'id': id,
    'sql': sql,
    'args': args
  };
  final List<dynamic> result =
      await _channel.invokeMethod('rawQuery', request);
  assert(result.length == 2);
  final List<String> cursorColumns =
      (result[0] as List<dynamic>).cast<String>();
  final List<List<dynamic>> cursorRows =
      (result[1] as List<dynamic>).cast<List<dynamic>>();
  return SQLiteCursor.from(columns: cursorColumns, rows: cursorRows);
}