findOne method

Future<Map> findOne (Find st)
override

Finds one record in the table

Implementation

Future<Map> findOne(Find st) async {
  String stStr = composeFind(st);
  sj.Results results = await _connection.execute(stStr);

  if (results.isEmpty) return null;

  List resList = results.toList();
  Map map = {};
  for (int i = 0; i < resList[0].length; i++) {
    Object value = resList[0][i];
    map[results.fields[i].name] = value;
  }
  return map;
}