GithubHelp home page GithubHelp logo

Comments (5)

incrediblezayed avatar incrediblezayed commented on August 22, 2024

Okay thanks for reporting, I'll look into it asap.

from file_saver.

incrediblezayed avatar incrediblezayed commented on August 22, 2024

@creativecreatorormaybenot Can you give more details? I tested it just now and it's working fine.

from file_saver.

creativecreatorormaybenot avatar creativecreatorormaybenot commented on August 22, 2024

@incrediblezayed I am currently not running the project anymore (granted I opened this issue 2 months ago). So if noone can reproduce it, I presume you can close it for now. I would let you know if I experience it again.

from file_saver.

incrediblezayed avatar incrediblezayed commented on August 22, 2024

@creativecreatorormaybenot really sorry for delayed responsible, I was busy with sone tests.

from file_saver.

MalikSamiAwan avatar MalikSamiAwan commented on August 22, 2024

@incrediblezayed is it solved its not working for me on windows
var bytes=excel.encode();
await storeFileAsBytes(Uint8List.fromList(bytes??[]),'xlsx',MimeType.MICROSOFTEXCEL,context,);

  `Future<bool> storeFileAsBytes(Uint8List bytes, String fileFormat, MimeType type,BuildContext context,{String? fileCustomName}) async {

try {
pprint('file url = $bytes');
String filename=generateTimeStampString();
if(fileCustomName!=null){
filename=fileCustomName;
}

  if(kIsWeb){
    var result = await FileSaver.instance
        .saveFile('$filename', bytes, fileFormat, mimeType: type);
    pprint(result, 2);
  }else if (Platform.isAndroid ||
      Platform.isIOS) {
    var result = await FileSaver.instance
        .saveAs('$filename', bytes, fileFormat,type);
    pprint(result, 2);
  } else {
    var result = await FileSaver.instance
        .saveFile('$filename', bytes, fileFormat, mimeType: type);
    pprint(result, 2);
    String path = filename;
    path = 'Dowload/' + path;
    await showSimpleDialog(context: context,title: 'SuccessFully! Downloaded',content: "$path");
  }
  return true;

} catch (e) {
pprint('for web');
pprint(e);
pprint(e);
await showSimpleDialog(context: context,title: 'Something Went Wrong!');
return false;
}
}
//get current date as random string to save file
String generateTimeStampString(){
DateTime today = new DateTime.now();
String dateSlug ="${today.year.toString()}-${today.month.toString().padLeft(2,'0')}-${today.day.toString().padLeft(2,'0')} ${today.hour.toString()}:${today.minute.toString()}:${today.second.toString()}:${today.microsecond.toString()}";
return dateSlug;
}`

from file_saver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.