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

isBase64 property won't work on release build #9

Open
brunodmn opened this issue Apr 14, 2021 · 0 comments
Open

isBase64 property won't work on release build #9

brunodmn opened this issue Apr 14, 2021 · 0 comments

Comments

@brunodmn
Copy link

I am trying to use isBase64 to check whether base64 string is valid before write and open a pdf file, but it works only on debug mode. When I compile release and try to use it, simply does nothing.

sample code:

import 'package:path_provider/path_provider.dart';
import 'dart:convert';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';

 Future<void> downloadPDF (String base64) async 
{
if(!isBase64(base64)
{
return ;
}

var bytes = base64Decode(base64);
   try {
      var output = await getTemporaryDirectory();
      var file = File("${output.path}/myFile.pdf");
      await file.writeAsBytes(bytes.buffer.asUint8List());
      await OpenFile.open("${output.path}/boleto.pdf");
    } catch (e) {
      print("$e");
    }
 }

Workaround is not to use the property and wrap code inside try block

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

1 participant