Using rive animation in flutter uses lots of Graphics memory - flutter

I tried to develop an application and was warming up all the rives files on app launch so that the rive animations could play properly. But during the gameplay, as you see more and more rive animation it was consuming more graphics memory (checked using the Android profile tool).
So after going through a lot of docs I found the possible fix.
Adding FlareCache.doesPrune = false;

Related

Animated splash screen for Android & iOS

To make an animation which can be used as splash screen for Android & iOS, I was thinking about using lotties (explained in this tutorial), but with Android 12 it seems like the tools used are deprecated and it's not really a good solution anymore.
I found this workaround to still make it work, but from what I understand, the splash screen is now waiting for the animation to finish, which I know is a bad practice and I don't really want to do that (maybe there is a way to interrupt it?).
I have seen some packages on pub.dev, but the animated ones seem to not really replace the launch screen (the white screen by default) and just start after it.
So my question is : is there any other way to create one animation which can be used both on Android & iOS? (which would be a looping animation, interrupted when the app is ready).

My animations are not smooth using animations package in flutter

am using the animations package in flutter for default animations but by using open container method from a listView item to a screen the animations are not smooth without any errors.
please help me guys.
Are you running the app in the iOS Simulator or Android Emulador? The Simulator/Emulator performance is not representative of real devices, so you should always test the app's performance on an actual device.
If not, are you running the app in debug mode? Debug mode is not optimized, and often the animations will be janky. Instead, try running your app on an actual device and in release mode (flutter run --release).

Keep video playing when app goes to the background and show player controller in the notification

Want this feature in flutter (android/IOS)
I want to keep the video playing when an app goes to the background and shows a player controller in the notification.
Is this possible?
You can try this library https://pub.dev/packages/just_audio with the latest version 0.9.21. It's quite easy to configure though some features are still experimental e.g Simultaneous downloading+caching, Background play which are here Experimental features. Overall it works for me.

Flutter API to record video

Flutter has no way to record video of the Flutter App.
I tried all the following, all have majors drawbacks that brings to ask this question
Using repaintBoundary
This method has 2 major drawbacks:
It draws blank white boxes on PlatformViews and WebViews (https://github.com/flutter/flutter/issues/25306 and Update 30 June https://github.com/flutter/flutter/issues/83856 it is in progress this quarter)
Bitmaps need to be sent back to the Native platform for encoding into mp4. (Using OpenGL)
Using native platform
Flutter exposes the getBitmap API that is meant be used on the Native Platform to capture a screenshot of the Running hosted Flutter App but this has 2 major drawbacks
It must run on UIThread so the FlutterApp is blocked, so the video is recording a blocked UI
This method is very slow. Sometimes up to 100 ms per frame depending on the screen content.
Recording the entire screen?
Using MediaRecorder that's possible but we want to:
Record the app only, not the entire screen
Recording the entire screen requires special permission from user
Drawing a canvas of the FlutterView in the Native platform?
This draws black screen because FlutterView is a SurfaceView and bitmap cannot be obtained as it was drawn on the different thread.
Use PixelCopy?
This API is only availabe on >= API 24
Does FLutter Expose an API to record Bitmaps continuously in the background not on the Main UI thread . (Or a video recording API but that's too much to ask)
Keywords: getBitmap, screenshot, bitmap, uithread, background, record, recording, screen shot, main thread, flutterview, surfaceview, video, mp4, mediarecorder, opengl, mediamuxer, mediaencoder

Flutter animation is not smooth at first time render

Why buildTransition on screen navigation even Hero animation is never smooth at first run?
How to make a prefect smooth animation always?
Kind Regards
You need to build with --release or --profile. If you run from IDE you'll get a --debug build by default, which is unsuitable to measure any performance metrics or animations or build output size.
flutter run --profile
More details in https://flutter.io/docs/testing/ui-performance
This is a known issue in flutter where you have to "warm-up" the graphic api (SkSL) first. After a third run, usually it will become smooth.
The problem happens in both iOS an Android.
For iSO, the lag usually occurs in metal api as Apple has recently dropped support for OpenGL which is usually where the Skia graphic engine is implemented.
Work around and temporary solution are found on this page.
Extreme jank on iOS/Android the first time any kind of animation or transition runs (release build) - skia shader compilation #61450
Update
Flutter has updated their official docs on this issue
Reduce shader compilation jank on mobile