rrousselGit / functional_widget

A code generator to write widgets as function without loosing the benefits of classes.
597 stars 46 forks source link

Remove check that return type is Widget to let people use dynamic (or whatever Widget they want) #28

Closed jaumard closed 5 years ago

jaumard commented 5 years ago

No sure if I have to change something on code_gen_tester... Let me know :)

rrousselGit commented 5 years ago

Thanks!

No need to change anything in code_gen_tester.

This is not exactly the desired behavior though.

We'll want to check that the ast node either has:

That is because the following should fail:

// This is not the real widget
class Widget {}

// It should not work because that's not the real Widget class
@widget
Widget foo() {}

And the following should not:

@widget
Text foo() => Text("Hello World");

This should technically work. But it will currently crash

We'll also want to add tests for all of these obviously 😄

jaumard commented 5 years ago

So I'm kind of block for now, I removed the fake_flutter to use a real one, but I don't know how to test that the return is a Widget or a subtype :/ as Widget is a Type and not a DartType.

Also I wasn't able to configure tests to run with flutter for some reasons... I'll keep searching but in the meantime if anyone have clues it will be cool ^^

jaumard commented 5 years ago

Just notice that travis will also need to have flutter available ^^ to run tests

rrousselGit commented 5 years ago

I'll close it for the time being. I'm not sure if it's truly desired.

The only use-case would be about using the function directly. But I don't want to encourage that.