We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CACHE SUPPORT WITH FLUTTER CACHE MANAGER
import 'package:flutter/material.dart'; import 'package:pedantic/pedantic.dart'; import 'package:model_viewer/model_viewer.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; ... @override Widget build(BuildContext context) { return FutureBuilder<String>( future: chached3DSrc(src), builder: (__, AsyncSnapshot<String> snapshot) { if (snapshot.connectionState == ConnectionState.done) { return ModelViewer( src: snapshot.data, autoPlay: true, autoRotate: true, autoRotateDelay: 0, cameraControls: true, ); } else { return SizedBox(); } }, ); } Future<String> chached3DSrc(String source) async { final BaseCacheManager _cacheManager = DefaultCacheManager(); final fileInfo = await _cacheManager.getFileFromCache(source); if (fileInfo == null || fileInfo.file == null) { unawaited(_cacheManager.downloadFile(source)); return source; } else { return "file://" + fileInfo.file.path; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
CACHE SUPPORT WITH FLUTTER CACHE MANAGER
The text was updated successfully, but these errors were encountered: