loadImage function
Implementation
Future<GBitmap> loadImage(String path, [bool cache = true]) async {
final isUrl = path.startsWith('http');
if (isUrl) {
if (!cache) {
return loadNetworkImage(path);
}
final cached = ResourceLoader.textureCache[path];
if (cached != null) {
return GBitmap(cached);
}
final image = await loadImageFromPath(path);
final texture = GTexture.fromImage(image);
ResourceLoader.textureCache[path] = texture;
return GBitmap(texture);
} else {
return loadLocalImage(path);
}
}