archive icon indicating copy to clipboard operation
archive copied to clipboard

Flutter web support

Open TejaDroid opened this issue 4 years ago • 3 comments

Can any one know me, how to use this plugin in flutter web? I want to compress list of image file in single zip file in flutter website.

TejaDroid avatar Sep 29 '20 07:09 TejaDroid

Thumbin up! Package is awesome, badge on pub.dev is showing that this package is JS and web-supported, but running it in Chrome throws: Unsupported: Platform._operatingSystem

tsinis avatar Oct 12 '20 20:10 tsinis

@TejaDroid Please have a look into: https://github.com/brendan-duncan/archive/issues/33#issuecomment-284298364

I used the same to create and download a zip for flutter web.

NOTE: You have to use platform specific import. For example:

import 'package:archive/archive.dart' as web;
import 'package:archive/archive_io.dart' as io;

if(kIsWeb) {
      web.Archive archive = web.Archive();
} else {
     io.Archive archive =  io.Archive();
}

AkshayNG avatar Oct 13 '20 13:10 AkshayNG

Hey @AkshayNG you are lifesaver! Thanks for pointing out, I can confirim conditional imports working lika a charm.

@TejaDroid Please have a look into: #33 (comment)

I used the same to create and download a zip for flutter web.

NOTE: You have to use platform specific import. For example:

import 'package:archive/archive.dart' as web;
import 'package:archive/archive_io.dart' as io;

if(kIsWeb) {
      web.Archive archive = web.Archive();
} else {
     io.Archive archive =  io.Archive();
}

tsinis avatar Oct 14 '20 20:10 tsinis