Advertisements
I added http package to my FLUTTER project and it works fine on the emulator but on old phones it’s not working .
How to make it work on old phone ?
>Solution :
Usually on dart you should have a .pem file that contains the encryption in your assets folder then you can add it like that in your main.dart file like that :
void main() async{
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
ByteData data = await PlatformAssetBundle().load('assets/yourkey.pem');
SecurityContext.defaultContext.setTrustedCertificatesBytes(data.buffer.asUint8List());
runApp(const MyApp());
}