Skip to content
New issue

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 svg stored on firebase #21

Open
prodigeomid opened this issue May 3, 2024 · 1 comment
Open

cache svg stored on firebase #21

prodigeomid opened this issue May 3, 2024 · 1 comment

Comments

@prodigeomid
Copy link

Hello how i can cache svg using firebase ?

@imsamgarg
Copy link
Owner

This package supports caching any kind of file, But it can not render SVG because Flutter does not yet support SVG files. One workaround over this is to use FutureBuilder to get the cached file path and display the SVG image using the flutter_svg package.

Example

FutureBuilder<String>(
  future: FirebaseCacheManager()
        getSingleFile(FirebaseUrl("gs://bucket_f233/logo.svg")),
  builder: (context, snapshot) {
    if (snapshot.hasData) {
      final file = File(snapshot.data!);

      return SvgPicture.file(file);
    }

    // Handle error and loading states

    return const CircularProgressIndicator();
  },
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants