-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Singleton pattern on BreezSDK using factory constructor #863
Conversation
- Move SDK config extension to it's own file. - Export bridge_generated.dart, breez_sdk.dart, exceptions.dart & sdk_config.dart files through sdk.dart - Filter out generated binding classes from bridge_generated.dart
39fb1e5
to
9abc6a8
Compare
App has no issues but tests are failing with
on C-Breez, which needs to be addressed before this PR gets merged. stacktrace Related: Testing Library functions in a flutter package with Native Functions using Dart::ffi |
Actually, after investigating our test cases & how they are structured on C-Breez, I can say this is not a blocker. This problem exists on our current test cases as well, but since we were passing To overcome this issue you need to build libraries for the platform you're on and move them to a directory accessible from test folder where you run This local library path can be configured on the Flutter plugin & used through a statement similar to the following we'll be adding to
Edit: I've been running C-Breez tests with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erdemyerebasmaz I agree with fixing the imports and testing with the real library instead of mock data. I am a bit hesitating regarding the singleton at this level.
Given the original user error was due to symbol stripping, can you elaborate on what moving to singleton fixes here?
That's true but I believe the issue can be reproduced if there's more than once instance of By moving to Singleton,
This is common practice on a large percent of plugins with similar requirements. We can improve the current implementation by reviewing how they addressed the shortcomings of using Singleton pattern, or move it down a layer to where we initialize Tests can still be mocked using dependency injection.
|
Apply Singleton pattern on
BreezSDK
using factory constructor.SdkConfig
extension to it's own file.bridge_generated.dart
,breez_sdk.dart
,exceptions.dart
&sdk_config.dart
files throughsdk.dart
bridge_generated.dart
I assumed an SDK partner encountered this issue because we were lazily creating a new instance on our documentation for Dart snippets and if taken as 1:1 example, it's likely to encounter this issue. However, it may very well be a symbol stripping issue on iOS.
Either way, I expect these changes to