dumpCursorToString method

Future<String> dumpCursorToString(
  1. Cursor cursor
)

Prints the contents of a Cursor to a string.

The position is restored after printing.

See: https://developer.android.com/reference/android/database/DatabaseUtils#dumpCursorToString(android.database.Cursor)

Implementation

static Future<String> dumpCursorToString(final Cursor cursor) async {
  assert(Platform.isAndroid);

  final buffer = StringBuffer();

  final position = cursor.getPosition();
  while (cursor.moveToNext()) {
    await dumpCurrentRowToStringBuffer(cursor, buffer);
    buffer.writeln();
  }
  cursor.moveToPosition(position);

  return buffer.toString();
}