add locations by search
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:weather_icons/weather_icons.dart';
|
||||
|
||||
@@ -31,3 +33,18 @@ IconData weatherIcon(String icon) {
|
||||
return WeatherIcons.alien;
|
||||
}
|
||||
}
|
||||
|
||||
class Debouncer {
|
||||
final int milliseconds;
|
||||
VoidCallback? action;
|
||||
Timer? _timer;
|
||||
|
||||
Debouncer({required this.milliseconds});
|
||||
|
||||
run(VoidCallback action) {
|
||||
if (_timer != null) {
|
||||
_timer!.cancel();
|
||||
}
|
||||
_timer = Timer(Duration(milliseconds: milliseconds), action);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user