To rotate the actual file in memory use the image
library and the copyRotate function.
Image copyRotate(Image src, num angle, {
Interpolation interpolation = Interpolation.nearest
}
);
//Returns a copy of the [src] image, rotated by [angle] degrees.
Example:
import 'dart:io';
import 'package:image/image.dart';
void main() {
// Read an image from file (webp in this case).
// decodeImage will identify the format of the image and use the appropriate
// decoder.
Image image = decodeImage(File('test.webp').readAsBytesSync());
Image thumbnail = copyRotate(image, 120);
// Save the thumbnail as a PNG.
File('thumbnail.png').writeAsBytesSync(encodePng(thumbnail));
}
source
To display a rotated version of the image stored, you can use a RotationTransition
with an AlwaysStoppedAnimation
like-
new RotatedBox(
quarterTurns: 1,
child: new Text("Lorem ipsum")
)
or the Transform.rotate()
widget like-
Transform.rotate(angle: - math.pi / 4, child: Text("Text"),);
for your use case-
Transform.rotate(angle: degrees*3.14/180, child: Image.asset("file_path"),);