anyDataToWidget method
Implementation
Widget anyDataToWidget({
required dynamic data,
required BuildContext context,
}) {
if (data is Widget) {
return data;
}
if (data is Future) {
return FutureBuilder(
future: data,
builder: (context, snapshot) {
final snapshotData = snapshot.data;
final isLoading = snapshot.connectionState.isLoading;
if (isLoading) {
return const CircularProgressIndicator();
}
return anyDataToWidget(data: snapshotData, context: context);
},
);
}
throw ErrorDescription("Data Not Widget Type");
}