buildDioWidget function

Widget buildDioWidget(
  1. {Future<HttpData> request,
  2. Widget busyWidget,
  3. bool rememberFutureResult,
  4. @required DioWidgetBuilder idleWidgetBuilder,
  5. DioWidgetBuilder errorWidgetBuilder}
)

Implementation

Widget buildDioWidget({
  Future<HttpData> request,
  Widget busyWidget,
  bool rememberFutureResult,
  @required DioWidgetBuilder idleWidgetBuilder,
  DioWidgetBuilder errorWidgetBuilder
}){
  return EasyFutureBuilder<HttpData>(
    future: request,
    rememberFutureResult: rememberFutureResult,
    whenWaiting: busyWidget??SpinKitRing(
      size: 20,
      color: Theme.of(context).primaryColor,
      lineWidth: 2,
    ),
    whenDone: (data){
      if(data.success){
        return idleWidgetBuilder(data);
      }else{
        if(isEmpty(errorWidgetBuilder)){
          return errorWidgetBuilder(data);
        }else{
          return Container();
        }
      }
    },
  );
}