Skip to content
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

Inferred type is String? but Any was expected. #31

Closed
gsbruno opened this issue Apr 26, 2021 · 5 comments
Closed

Inferred type is String? but Any was expected. #31

gsbruno opened this issue Apr 26, 2021 · 5 comments

Comments

@gsbruno
Copy link

gsbruno commented Apr 26, 2021

Hello, first thanks for the package, very useful.

I found a problem in the following code snippet(File: FlutterMidiCommandPlugin.kt, Line: 389, Column: 34).

Error: Inferred type is String? but Any was expected.

fun listOfDevices() : List<Map<String, Any>> {
    var list = mutableListOf<Map<String, Any>>()

    val devs:Array<MidiDeviceInfo> = midiManager.devices
    Log.d("FlutterMIDICommand", "devices $devs")
    devs.forEach { d -> list.add(mapOf(
            "name" to d.properties.getString(MidiDeviceInfo.PROPERTY_NAME),
            "id" to d.id.toString(),
            "type" to "native",
            "connected" to if (connectedDevices.contains(d.id.toString())) "true" else "false",
            "inputs" to listOfPorts(d.inputPortCount),
            "outputs" to listOfPorts(d.outputPortCount)
          )
    )}

It must be something related to a kotlin update where the type Any is not used for null, but Any? works.

Again, thanks for the package.

@mortenboye
Copy link
Contributor

It's unclear to me what the issue is. What kinds of errors are you seeing?

@gsbruno
Copy link
Author

gsbruno commented Apr 26, 2021

Sorry about that, the error is in the title. Inferred type is String? but Any was expected.

@mortenboye
Copy link
Contributor

Ah yes. I found it, fixing now.

@mortenboye
Copy link
Contributor

@gsbruno fixed in 8e2f8bc

@gsbruno
Copy link
Author

gsbruno commented Apr 26, 2021

Thanks for the quick feedback.

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

No branches or pull requests

2 participants