networkFirstThenLocal static method

Widget networkFirstThenLocal(
  1. String? path, {
  2. BoxFit? fit = BoxFit.contain,
  3. Widget? defaultWidget,
})

优先网络图片,带缓存

  • 然后是本地asset图片

Implementation

static Widget networkFirstThenLocal(
  String? path, {
  BoxFit? fit = BoxFit.contain,
  Widget? defaultWidget,
}) {
  if (path?.startsWith("http") == true) {
    return cacheNetWork(path, fit: fit, defaultWidget: defaultWidget);
  } else {
    if (FFEmpty.stringIsEmpty(path)) {
      return defaultWidget ?? Container();
    }
    return asset(path!, fit: fit);
  }
}