pluck method

dynamic pluck(
  1. dynamic col
)

Implementation

dynamic pluck(col) async {
  var result = [];
  var map = {};

  await all();

  _result.asMap().forEach((k, value) {
    value.forEach((column, v) {
      if (col.runtimeType.toString().contains("List<String>")) {
        col.asMap().forEach((colKey, colValue) {
          if (col[1] == column) {
            map.putIfAbsent(value[col[0]], () => v);
          }
        });
      } else {
        if (col == column) {
          result.add(v);
        }
      }
    });
  });

  return result.isEmpty ? map : result;
}