The error will occur when:
- Uploading images of more than 10 MB
- Uploading a large image but low than 10MB like 7MB then rotate it by using
import 'dart:typed_data';
import 'package:image/image.dart';
Image? image = decodeImage(file);
if (image == null) return file;
image = copyRotate(image, angle: rotate * 90);
file = Uint8List.fromList(encodePng(image));
The error in the terminal is
/snap/flutter/130/dart.sh: line 20: 49710 Killed $DART "$@"
This issue forced the dart server to stop running. How to solve it?
My host is Ubuntu 20.04 and uses Nginx.
I asked the chatGPT, he said this issue indicates the Dart process was terminated because a process runs out of memory. but I wonder about it. This process is uploading images with a size of more than 10MB. Just 10MB can terminate the app but I am using the host with 1GB memory. I followed the solution from the chatGPT that is adding client_max_body_size 1024M;
in the nginx.conf
, but this solution doesn't work.