autoquery property

int? get autoquery

Implementation

int? get autoquery => _autoquery;
set autoquery (dynamic autoquery)

Implementation

set autoquery(dynamic autoquery) {
  _autoquery = 0;
  if (autoquery == null) return;

  int factor = 1;
  if (autoquery is String) {
    autoquery = autoquery.trim().toLowerCase();
    if (autoquery.endsWith('s')) {
      factor = 1;
    } else if (autoquery.endsWith('m')) {
      factor = 1 * 60;
    } else if (autoquery.endsWith('h')) {
      factor = 1 * 60 * 60;
    } else if (autoquery.endsWith('d')) {
      factor = 1 * 60 * 60 * 24;
    }
    if (autoquery.endsWith('s') ||
        autoquery.endsWith('m') ||
        autoquery.endsWith('h') ||
        autoquery.endsWith('d')) {
      autoquery = (autoquery.length > 1)
          ? autoquery.substring(0, autoquery.length - 1)
          : null;
    }
  }

  if (isNumeric(autoquery)) {
    int t = toInt(autoquery)! * factor;
    if (t >= 0) _autoquery = t;
  }
}