mobile_scanner icon indicating copy to clipboard operation
mobile_scanner copied to clipboard

Use `sharedDarwinSource` to share MacOS and iOS implementation details

Open navaronbracke opened this issue 10 months ago • 1 comments

Since the MacOS implementation is very small, it is probably worth it to make use of the new sharedDarwinSource configuration.

Then we can have a single implementation that handles both platforms, which simplifies maintenance.

See https://docs.flutter.dev/packages-and-plugins/developing-packages#shared-ios-and-macos-implementations

This will require bumping the minimum Flutter version to 3.7.0

TODO:

  • the DetectionSpeed.swift file is essentially the same between the two -> deduplicate it
  • the iOS implementation has a BarcodeHandler event sink wrapper, but MacOS does not -> share it between MacOS & iOS
    • a first step for this would be to have MacOS port the BarcodeHandler over from iOS, in a separate PR
  • the main implementation can be shared using available checks where needed
  • We can probably also address https://github.com/juliansteenbakker/mobile_scanner/issues/777 with this refactor
  • toggleTorch currently has two implementations, this can be shared and deduplicated

navaronbracke avatar Oct 12 '23 20:10 navaronbracke

Cool, I've been looking for something like this a few months ago but could not find anything. Nice to see this feature in Flutter!

juliansteenbakker avatar Oct 12 '23 20:10 juliansteenbakker