hpoul / file_picker_writable

Flutter plugin to choose files which can be read, referenced and written back at a later time.
https://pub.dev/packages/file_picker_writable
MIT License
17 stars 13 forks source link

Won't build for Android with Flutter 3.0 #30

Closed amake closed 2 years ago

amake commented 2 years ago

When attempting to build for Android with Flutter 3.0 you get the following error:

e: /Applications/flutter/.pub-cache/git/file_picker_writable-e1fe4af1792d8f5d92dedd1311a46a1ffc3dfa4c/android/src/main/kotlin/codeux/design/filepicker/file_picker_writable/FilePickerWritableImpl.kt: (31, 1): Class 'FilePickerWritableImpl' is not abstract and does not implement abstract member public abstract fun onNewIntent(p0: Intent): Boolean defined in io.flutter.plugin.common.PluginRegistry.NewIntentListener
e: /Applications/flutter/.pub-cache/git/file_picker_writable-e1fe4af1792d8f5d92dedd1311a46a1ffc3dfa4c/android/src/main/kotlin/codeux/design/filepicker/file_picker_writable/FilePickerWritableImpl.kt: (485, 3): 'onNewIntent' overrides nothing

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':file_picker_writable:compileDebugKotlin'.
> Compilation error. See log for more details

The issue is that the intent parameter of NewIntentListener#onNewIntent has been given a @NonNull annotation, which effectively changes the interface. Simply changing onNewIntent(intent: Intent?) in FilePickerWritableImpl.kt to onNewIntent(intent: Intent) will fix the problem for newer Flutter, but I don't know if the parameter could ever have been null in the past, so I'm not sure what to do about older Flutter versions.

hpoul commented 2 years ago

fixed by simply changing parameter to not-nullable.