Flutter知识点二

2021-05-25  本文已影响0人  小言聊编程

Multiple module support or walk around

  1. Import multiple Flutter modules in a native app is not support now. About the detail please go to:
    cause: It seems that Flutter doesn't support this use-case because FlutterEngine can only load a single specific set of AOT snapshots in an application. In my case, each module has its own Flutter part then each has its own set of AOT snapshots in its distribution.

https://github.com/flutter/flutter/issues/39707

flutter组件化开发:https://juejin.im/post/5c14cd8351882509e0270818
https://juejin.im/entry/5c164cad51882547eb539d21

  1. Workaround

ARM/X86 CPU mode support

https://flutter.dev/docs/development/add-to-app/android/project-setup

Flutter currently only supports building ahead-of-time (AOT) compiled libraries for x86_64, armeabi-v7a and arm64-v8a.

The Flutter engine has an x86 and x86_64 version. When using an emulator in debug Just-In-Time (JIT) mode, the Flutter module still runs correctly.

Flutter code in Module/applications/plug-in/package form

https://flutter.dev/docs/development/packages-and-plugins
https://jekton.github.io/2018/09/16/flutter-plugin-dev/
https://juejin.im/post/5cda8401e51d453b6d4d144e
https://flutter.dev/docs/development/add-to-app
https://flutter.dev/docs/development/add-to-app/android/add-flutter-screen
https://dart.dev/guides/libraries/create-library-packages
issue: https://stackoverflow.com/questions/61265088/flutter-plugin-registrar-context-and-registrar-activity-always-null

Certificate pinning

https://github.com/flutter/flutter/issues/16066
https://square.github.io/okhttp/3.x/okhttp/okhttp3/CertificatePinner.html
https://github.com/dart-lang/sdk/issues/35981
https://github.com/flutterchina/dio#https-certificate-verification

安卓certificate pinning介绍:https://blog.csdn.net/pcsxk/article/details/103057491

Pinning is the process of associating a host with their expected X509 certificate or public key. Once a certificate or public key is known or seen for a host, the certificate or public key is associated or ‘pinned’ to the host. If more than one certificate or public key is acceptable, then the program holds a pinset

https://medium.com/@appmattus/android-security-ssl-pinning-1db8acb6621e

Firebase Analytics function

https://firebase.google.com/docs/flutter/setup?platform=android

SQLite integration

https://pub.dev/packages/sqflite

demo of flutter plugin package:
issue: can't build flutter apk.

issue:error: constructor MyFlutterPlugin in class MyFlutterPlugin cannot be applied to given types;
flutterEngine.getPlugins().add(new com.example.my_flutter_plugin.MyFlutterPlugin()); required: Context
found: no arguments
reason: actual and formal argument lists differ in length

对于Flutter,它支持常见的debug,release,profile等模式,但它又有其不一样。

  1. Debug模式:对应了Dart的JIT模式,又称检查模式或者慢速模式。支持设备,模拟器(iOS/Android),此模式下打开了断言,包括所有的调试信息,服务扩展和Observatory等调试辅助。此模式为快速开发和运行做了优化,但并未对执行速度,包大小和部署做优化。Debug模式下,编译使用JIT技术,支持广受欢迎的亚秒级有状态的hot reload。
  2. Release模式:对应了Dart的AOT模式,此模式目标即为部署到终端用户。只支持真机,不包括模拟器。关闭了所有断言,尽可能多地去掉了调试信息,关闭了所有调试工具。为快速启动,快速执行,包大小做了优化。禁止了所有调试辅助手段,服务扩展。
  3. Profile模式:类似Release模式,只是多了对于Profile模式的服务扩展的支持,支持跟踪,以及最小化使用跟踪信息需要的依赖,例如,observatory可以连接上进程。Profile并不支持模拟器的原因在于,模拟器上的诊断并不代表真实的性能。

$ powershell .\x-execute-wrapping.ps1 [input_apk_path]
jarsigner -verbose -keystore C:\MyAndroid\debug.keystore -signedjar release_signed.apk C:\project\ds-app-release_wrapped.apk 'test'

PKCS #12(P12)定义了一种存档文件格式,用于实现存储许多加密对象在一个单独的文件中。通常用它来打包一个私钥及有关的 X.509 证书,或者打包信任链的全部项目
SSL证书格式:https://blog.freessl.cn/ssl-cert-format-introduce/
SSL(Secure Sockets Layer 安全套接字协议)
Android : 关于HTTPS、TLS/SSL认证以及客户端证书导入方法:https://www.cnblogs.com/blogs-of-lxl/p/10136582.html

上一篇下一篇

猜你喜欢

热点阅读