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

Image saving in local storage. #20

Closed
ibrahim-cse opened this issue Feb 9, 2022 · 6 comments
Closed

Image saving in local storage. #20

ibrahim-cse opened this issue Feb 9, 2022 · 6 comments

Comments

@ibrahim-cse
Copy link

Hello,
I am trying to save the image in local storage using a path. But facing some issues. I was using your code but seems like I am unable to solve these errors.
image

@omarhurani
Copy link
Owner

Can you show me the full code please?

@ibrahim-cse
Copy link
Author

ibrahim-cse commented Feb 9, 2022 via email

@omarhurani
Copy link
Owner

omarhurani commented Feb 9, 2022

Yes, you'll just need to make the function asynchronous and await the future.

void renderAndSaveImage() async {
    if (backgroundImage == null) return;
    final backgroundImageSize = Size(
        backgroundImage!.width.toDouble(), backgroundImage!.height.toDouble());

    // Render the image
    // Returns a [ui.Image] object, convert to to byte data and then to Uint8List
    final image = await controller.renderImage(backgroundImageSize);
    final byteData = await image.pngBytes;

    if(byteData  == null) return;

    // Save image to the temporary directory.
    final file = File('${(await getTemporaryDirectory()).path}/img.png');
    await file.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
}

@ibrahim-cse
Copy link
Author

ibrahim-cse commented Feb 9, 2022 via email

@omarhurani
Copy link
Owner

Well getTemporaryDirectory gets the cache directory of the device. Check out the path provider documentation to see which directory suits you better.

@ibrahim-cse
Copy link
Author

ibrahim-cse commented Feb 10, 2022 via email

vickyleu pushed a commit to vickyleu/flutter_painter that referenced this issue Sep 8, 2022
# This is the 1st commit message:

modify

# This is the commit message omarhurani#2:

modify

# This is the commit message omarhurani#3:

windows toolbar hidden

# This is the commit message omarhurani#4:

init commit

# This is the commit message omarhurani#5:

init commit

# This is the commit message omarhurani#6:

init commit

# This is the commit message omarhurani#7:

windows toolbar hidden

# This is the commit message omarhurani#8:

init commit

# This is the commit message omarhurani#9:

modify

# This is the commit message omarhurani#10:

modify

# This is the commit message omarhurani#11:

windows toolbar hidden

# This is the commit message omarhurani#12:

fullscreen zoom in/out in macos and windows compact

# This is the commit message omarhurani#13:

fullscreen zoom in/out in macos and windows compact

# This is the commit message omarhurani#14:

fullscreen zoom in/out in macos and windows compatible, but zoom still crash

# This is the commit message omarhurani#15:

modify

# This is the commit message omarhurani#16:

modify

# This is the commit message omarhurani#17:

windows toolbar hidden

# This is the commit message omarhurani#18:

modify

# This is the commit message omarhurani#19:

windows toolbar hidden

# This is the commit message omarhurani#20:

windows toolbar hidden

# This is the commit message omarhurani#21:

webrtc screen share

# This is the commit message omarhurani#22:

crash rep

# This is the commit message omarhurani#23:

macos screen share

# This is the commit message omarhurani#24:

screen share with sfu server

# This is the commit message omarhurani#25:

screen share with sfu server

# This is the commit message omarhurani#26:

screen share with sfu server

# This is the commit message omarhurani#27:

screen share with sfu server

# This is the commit message omarhurani#28:

screen share with sfu server

# This is the commit message omarhurani#29:

screen share with sfu server

# This is the commit message omarhurani#30:

nsd host finding by intranet

# This is the commit message omarhurani#31:

nsd host finding by intranet

# This is the commit message omarhurani#32:

nsd host finding by intranet

# This is the commit message omarhurani#33:

commit

# This is the commit message omarhurani#34:

nsd host finding by intranet

# This is the commit message omarhurani#35:

nsd host finding by intranet

# This is the commit message omarhurani#36:

nsd host finding by intranet

# This is the commit message omarhurani#37:

commit

# This is the commit message omarhurani#38:

commit

# This is the commit message omarhurani#39:

nsd host finding by intranet

# This is the commit message omarhurani#40:

nsd host finding by intranet

# This is the commit message omarhurani#41:

msvcp140  64 bit dll

# This is the commit message omarhurani#42:

commit

# This is the commit message omarhurani#43:

msvcp140  64 bit dll

# This is the commit message omarhurani#44:

msvcp140  64 bit dll

# This is the commit message omarhurani#45:

msvcp140  64 bit dll

# This is the commit message omarhurani#46:

msvcp140  64 bit dll

# This is the commit message omarhurani#47:

msvcp140  64 bit dll

# This is the commit message omarhurani#48:

msvcp140  64 bit dll

# This is the commit message omarhurani#49:

wm touch track

# This is the commit message omarhurani#50:

commit

# This is the commit message omarhurani#51:

commit

# This is the commit message omarhurani#52:

commit

# This is the commit message omarhurani#53:

wm touch track

# This is the commit message omarhurani#54:

commit

# This is the commit message omarhurani#55:

commit

# This is the commit message omarhurani#56:

commit

# This is the commit message omarhurani#57:

wm touch track

# This is the commit message omarhurani#58:

commit

# This is the commit message omarhurani#59:

commit

# This is the commit message omarhurani#60:

commit

# This is the commit message omarhurani#61:

wm touch track

# This is the commit message omarhurani#62:

wm touch track

# This is the commit message omarhurani#63:

wm touch track

# This is the commit message omarhurani#64:

wm touch track

# This is the commit message omarhurani#65:

wm touch track

# This is the commit message omarhurani#66:

commit

# This is the commit message omarhurani#67:

wm touch track

# This is the commit message omarhurani#68:

wm touch track

# This is the commit message omarhurani#69:

commit

# This is the commit message omarhurani#70:

wm touch track

# This is the commit message omarhurani#71:

wm touch track

# This is the commit message omarhurani#72:

eraser

# This is the commit message omarhurani#73:

wm touch track

# This is the commit message omarhurani#74:

wm touch track

# This is the commit message omarhurani#75:

commit

# This is the commit message omarhurani#76:

wm touch track

# This is the commit message omarhurani#77:

wm touch track

# This is the commit message omarhurani#78:

wm touch track

# This is the commit message omarhurani#79:

wm touch track

# This is the commit message omarhurani#80:

wm touch track

# This is the commit message omarhurani#81:

wm touch track

# This is the commit message omarhurani#82:

wm touch track

# This is the commit message omarhurani#83:

wm touch track

# This is the commit message omarhurani#84:

wm touch track

# This is the commit message omarhurani#85:

wm touch track

# This is the commit message omarhurani#86:

wm touch track

# This is the commit message #87:

wm touch track

# This is the commit message #88:

wm touch track

# This is the commit message #89:

wm touch track

# This is the commit message #90:

wm touch track

# This is the commit message #91:

wm touch track

# This is the commit message #92:

wm touch track

# This is the commit message #93:

wm touch track

# This is the commit message #94:

wm touch track

# This is the commit message #95:

eraser

# This is the commit message #96:

eraser

# This is the commit message #97:

eraser

# This is the commit message #98:

wm touch track

# This is the commit message #99:

eraser

# This is the commit message #100:

file manager

# This is the commit message #101:

file manager

# This is the commit message #102:

file manager

# This is the commit message #103:

file manager
vickyleu pushed a commit to vickyleu/flutter_painter that referenced this issue Sep 8, 2022
# This is the 1st commit message:

modify

# This is the commit message omarhurani#2:

modify

# This is the commit message omarhurani#3:

windows toolbar hidden

# This is the commit message omarhurani#4:

init commit

# This is the commit message omarhurani#5:

init commit

# This is the commit message omarhurani#6:

init commit

# This is the commit message omarhurani#7:

windows toolbar hidden

# This is the commit message omarhurani#8:

init commit

# This is the commit message omarhurani#9:

modify

# This is the commit message omarhurani#10:

modify

# This is the commit message omarhurani#11:

windows toolbar hidden

# This is the commit message omarhurani#12:

fullscreen zoom in/out in macos and windows compact

# This is the commit message omarhurani#13:

fullscreen zoom in/out in macos and windows compact

# This is the commit message omarhurani#14:

fullscreen zoom in/out in macos and windows compatible, but zoom still crash

# This is the commit message omarhurani#15:

modify

# This is the commit message omarhurani#16:

modify

# This is the commit message omarhurani#17:

windows toolbar hidden

# This is the commit message omarhurani#18:

modify

# This is the commit message omarhurani#19:

windows toolbar hidden

# This is the commit message omarhurani#20:

windows toolbar hidden

# This is the commit message omarhurani#21:

webrtc screen share

# This is the commit message omarhurani#22:

crash rep

# This is the commit message omarhurani#23:

macos screen share

# This is the commit message omarhurani#24:

screen share with sfu server

# This is the commit message omarhurani#25:

screen share with sfu server

# This is the commit message omarhurani#26:

screen share with sfu server

# This is the commit message omarhurani#27:

screen share with sfu server

# This is the commit message omarhurani#28:

screen share with sfu server

# This is the commit message omarhurani#29:

screen share with sfu server

# This is the commit message omarhurani#30:

nsd host finding by intranet

# This is the commit message omarhurani#31:

nsd host finding by intranet

# This is the commit message omarhurani#32:

nsd host finding by intranet

# This is the commit message omarhurani#33:

commit

# This is the commit message omarhurani#34:

nsd host finding by intranet

# This is the commit message omarhurani#35:

nsd host finding by intranet

# This is the commit message omarhurani#36:

nsd host finding by intranet

# This is the commit message omarhurani#37:

commit

# This is the commit message omarhurani#38:

commit

# This is the commit message omarhurani#39:

nsd host finding by intranet

# This is the commit message omarhurani#40:

nsd host finding by intranet

# This is the commit message omarhurani#41:

msvcp140  64 bit dll

# This is the commit message omarhurani#42:

commit

# This is the commit message omarhurani#43:

msvcp140  64 bit dll

# This is the commit message omarhurani#44:

msvcp140  64 bit dll

# This is the commit message omarhurani#45:

msvcp140  64 bit dll

# This is the commit message omarhurani#46:

msvcp140  64 bit dll

# This is the commit message omarhurani#47:

msvcp140  64 bit dll

# This is the commit message omarhurani#48:

msvcp140  64 bit dll

# This is the commit message omarhurani#49:

wm touch track

# This is the commit message omarhurani#50:

commit

# This is the commit message omarhurani#51:

commit

# This is the commit message omarhurani#52:

commit

# This is the commit message omarhurani#53:

wm touch track

# This is the commit message omarhurani#54:

commit

# This is the commit message omarhurani#55:

commit

# This is the commit message omarhurani#56:

commit

# This is the commit message omarhurani#57:

wm touch track

# This is the commit message omarhurani#58:

commit

# This is the commit message omarhurani#59:

commit

# This is the commit message omarhurani#60:

commit

# This is the commit message omarhurani#61:

wm touch track

# This is the commit message omarhurani#62:

wm touch track

# This is the commit message omarhurani#63:

wm touch track

# This is the commit message omarhurani#64:

wm touch track

# This is the commit message omarhurani#65:

wm touch track

# This is the commit message omarhurani#66:

commit

# This is the commit message omarhurani#67:

wm touch track

# This is the commit message omarhurani#68:

wm touch track

# This is the commit message omarhurani#69:

commit

# This is the commit message omarhurani#70:

wm touch track

# This is the commit message omarhurani#71:

wm touch track

# This is the commit message omarhurani#72:

eraser

# This is the commit message omarhurani#73:

wm touch track

# This is the commit message omarhurani#74:

wm touch track

# This is the commit message omarhurani#75:

commit

# This is the commit message omarhurani#76:

wm touch track

# This is the commit message omarhurani#77:

wm touch track

# This is the commit message omarhurani#78:

wm touch track

# This is the commit message omarhurani#79:

wm touch track

# This is the commit message omarhurani#80:

wm touch track

# This is the commit message omarhurani#81:

wm touch track

# This is the commit message omarhurani#82:

wm touch track

# This is the commit message omarhurani#83:

wm touch track

# This is the commit message omarhurani#84:

wm touch track

# This is the commit message omarhurani#85:

wm touch track

# This is the commit message omarhurani#86:

wm touch track

# This is the commit message #87:

wm touch track

# This is the commit message #88:

wm touch track

# This is the commit message #89:

wm touch track

# This is the commit message #90:

wm touch track

# This is the commit message #91:

wm touch track

# This is the commit message #92:

wm touch track

# This is the commit message #93:

wm touch track

# This is the commit message #94:

wm touch track

# This is the commit message #95:

eraser

# This is the commit message #96:

eraser

# This is the commit message #97:

eraser

# This is the commit message #98:

wm touch track

# This is the commit message #99:

eraser

# This is the commit message #100:

file manager

# This is the commit message #101:

file manager

# This is the commit message #102:

file manager

# This is the commit message #103:

file manager

# This is the commit message #104:

wm touch track
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