Skip to content

Inline functions parameter type override #30878

Closed
@jacehensley-wf

Description

@jacehensley-wf

In Dart 2 I am seeing infos about some typing (uses_dynamic_as_bottom) and I don't know how I would get around it.

Basically I have something like:

new A()
  ..func = (int a) {};

Where A.func is of typeFunction(dynamic a)

If I make it Function(Object a) then it becomes an error:

"A value of type '(int) → Null' can't be assigned to a variable of type 'Function(Object) → dynamic'."

I put together a dartpad of a few things to try and make something work and clarify some rules for myself, but I couldn't find a way to make inline functions like that work.

https://dartpad.dartlang.org/22a4849f9f0d2fcd3813024df252adf0

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).closed-staleClosed as the issue or PR is assumed stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions