performFuture<U> method
To avoid use of startLoading and stopLoading you use use performFuture which will show the loader until the passed future call is done executing
Implementation
Future<U?> performFuture<U>(Function futureCallback) async {
startLoading();
U? data = await futureCallback();
stopLoading();
return data;
}