Skip to content

Conversation

@jeroen-meijer
Copy link

@jeroen-meijer jeroen-meijer commented Oct 14, 2023

Description

This PR updates various aspects of the package to improve code safety, styling and idiomaticity. In particular, these changes have been implemented:

  • chore: version bump to 2.0.0
  • feat!: Many classes have been altered in small and significant ways. In particular, expect these types of changes:
    • Most classes are now marked immutable.
    • Functions that previously returned a Future<bool> now return a Future<void>. In cases where these functions returned false, they now throw an exception.
    • Functions that internally caught exceptions and returned null now throw those exceptions.
  • chore!: upgrade Dart SDK constraint to 3.0.0 or higher, upgrade Flutter SDK constraint to 3.10.0 or higher.
  • feat: add logger.dart for consumer-customizable logging (import package:esp_provisioning_softap/logger.dart and set logger as desired).
  • chore: add very_good_analysis package and linter rules and fix all issues.
  • chore: upgrade all dependencies to latest versions.
  • chore: format all files.

What should be done after this PR merged?

A new version has to be pushed to https://pub.dev.

Remaining work

I recommend to add a subsequent PR with additional cleanup:

  • Remove unused methods.
  • Add documentation to the library, all classes and methods.
  • Add tests (at least to critical infrastructure, preferably to the entire codebase with 100% code coverage).
  • Add CI/CD configurations through GitHub Actions for automated testing, verification and deployment.

If you have any questions, feel free to reach out. Hope this helps.
Thanks for all your work!

@jeroen-meijer jeroen-meijer changed the title feat!: v2.0.0 - upgrade dependencies, improved null-safety feat!: v2.0.0 (BREAKING) upgrade dependencies, improved null-safety Oct 14, 2023

Provisioning({required this.transport, required this.security});

Future<bool> establishSession() async {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so from jsut checking for a bool you'll rather change to a try/catch?

Copy link

@jeroenbloom jeroenbloom Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

I believe the old way is faulty API design, since it obfuscates the error that occurred and instead simply returns false. That doesn't allow consumers (client apps) to make good decisions on how to handle the error depending on what kind of error was thrown.

If consumers still want to treat this as false, they can simply do so using a try/catch themselves.

@FlYnN91
Copy link

FlYnN91 commented Jan 19, 2024

This would be very useful. I am trying to integrate this module with flutterflow and it's failing badly. Even the example does not build on Android Studio.

Just to note that the example app does not run. Keeps throwing this error:

E/AndroidRuntime(26940): FATAL EXCEPTION: main
E/AndroidRuntime(26940): Process: de.petersen.nico.esp_provisioning_softap_example, PID: 26940
E/AndroidRuntime(26940): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.petersen.nico.esp_provisioning_softap_example/de.petersen.nico.esp_provisioning_softap_example.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "de.petersen.nico.esp_provisioning_softap_example.MainActivity" on path: DexPathList[[zip file "/data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/base.apk"],nativeLibraryDirectories=[/data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/lib/arm64, /data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]
E/AndroidRuntime(26940): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3978)
E/AndroidRuntime(26940): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4247)
E/AndroidRuntime(26940): 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
E/AndroidRuntime(26940): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
E/AndroidRuntime(26940): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
E/AndroidRuntime(26940): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613)
E/AndroidRuntime(26940): 	at android.os.Handler.dispatchMessage(Handler.java:110)
E/AndroidRuntime(26940): 	at android.os.Looper.loop(Looper.java:219)
E/AndroidRuntime(26940): 	at android.app.ActivityThread.main(ActivityThread.java:8668)
E/AndroidRuntime(26940): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(26940): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
E/AndroidRuntime(26940): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
E/AndroidRuntime(26940): Caused by: java.lang.ClassNotFoundException: Didn't find class "de.petersen.nico.esp_provisioning_softap_example.MainActivity" on path: DexPathList[[zip file "/data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/base.apk"],nativeLibraryDirectories=[/data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/lib/arm64, /data/app/de.petersen.nico.esp_provisioning_softap_example-SyKG-K1TMK98dW40PV6Drw==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64]]
E/AndroidRuntime(26940): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:209)
E/AndroidRuntime(26940): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(26940): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(26940): 	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
E/AndroidRuntime(26940): 	at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
E/AndroidRuntime(26940): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1264)
E/AndroidRuntime(26940): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3963)
E/AndroidRuntime(26940): 	... 11 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants