Skip to content

isBase64 property won't work on release build #9

@brunodmn

Description

@brunodmn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions