MaterialApp does not have home attribute

114 views
Skip to first unread message

alvaro arcas

unread,
May 20, 2016, 1:41:45 PM5/20/16
to Flutter Dev
Hi, im new at flutter and i am trying to use the new tutorial of the code labs but the app does not run because MaterialApp constructor does not have a home parameter.
Any idea? What im doing wrong?
Thanks.

Ian Hickson

unread,
May 20, 2016, 1:44:20 PM5/20/16
to alvaro arcas, Flutter Dev
You are probably running on an old version of Flutter. Try running "flutter upgrade". If that doesn't work, try running "flutter doctor" and paste the results here and we'll see if there might be something else wrong!

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To post to this group, send email to flutt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/1616cfab-f824-412f-b46e-78e1bf04625b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

alvaro arcas

unread,
May 20, 2016, 1:50:33 PM5/20/16
to Flutter Dev
This is the console log
Building APK...
Warning: signing the APK using the debug keystore.
Generated APK to build/app.apk.
Installing app.apk on device.
Starting lib/main.dart on Nexus 4...
exception: [NoSuchMethodError objects/7]
Showing Nexus 4 logs:
--------- beginning of system
--------- beginning of main
E/flutter : [ERROR:dart_error.cc(17)] Unhandled exception:
E/flutter : No constructor 'MaterialApp' with matching arguments declared in class 'MaterialApp'.
E/flutter : 
E/flutter : NoSuchMethodError: incorrect number of arguments passed to method named 'MaterialApp'
E/flutter : Receiver: Type: class 'MaterialApp'
E/flutter : Tried calling: MaterialApp(title: "Firechat", theme: Instance of 'ThemeData', home: Instance of 'ChatScreen')
E/flutter : Found: MaterialApp({key: Key, title: String, theme: ThemeData, routes: Map<String, WidgetBuilder>, onGenerateRoute: RouteFactory, onLocaleChanged: LocaleChangedCallback, debugShowMaterialGrid: dynamic, showPerformanceOverlay: bool, showSemanticsDebugger: bool, debugShowCheckedModeBanner: bool})
E/flutter : #0      NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:188)
E/flutter : #1      main (/Users/arcas/flutter_projects/myfirechat/lib/main.dart:5)
E/flutter : #2      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:261)
E/flutter : #3      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
W/ActivityManager: Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.PrivilegedProcessService1 in 1000ms

And this the MaterialApp Constructor:
runApp(new MaterialApp(
      title: "Firechat",
      theme: new ThemeData(
          primarySwatch: Colors.purple, accentColor: Colors.orangeAccent[400]),
      home: new ChatScreen()));
My flutter version is 0.0.21 that is the newest in pub dart.

Marius Räsener

unread,
May 20, 2016, 4:19:14 PM5/20/16
to Flutter Dev
Hey Alvaro,

I don't know why the 'home' thing isn't working, but I could work around this with replacing it with something like this:

    routes: <String, WidgetBuilder> {

        '/':    (BuildContext context) => new SomeWidget()

    }


hope it helps,

Marius

Ian Hickson

unread,
May 20, 2016, 4:19:21 PM5/20/16
to alvaro arcas, Flutter Dev
Oh you don't want to use the version in pub. Please make sure you follow the instructions at the top of the codelab for how to obtain Flutter (or see flutter.io). 

Having said that, I'm confused. The version on pub is 0.0.20, and doesn't have any code at all (just a README pointing you to the site). Where did you get 0.0.21? :-)

-- 
Ian Hickson

alvaro arcas

unread,
May 20, 2016, 4:22:01 PM5/20/16
to Flutter Dev
I have reinstall flutter but does not work the home atribute. I will use the routes solution thanks.

Ian Hickson

unread,
May 20, 2016, 4:24:36 PM5/20/16
to alvaro arcas, Flutter Dev
alvaro, can you paste the output of running `flutter doctor`? I suspect this is hiding a more serious underlying problem. The `home` attribute shouldn't be missing.

On Fri, May 20, 2016 at 1:22 PM alvaro arcas <arca...@gmail.com> wrote:
I have reinstall flutter but does not work the home atribute. I will use the routes solution thanks.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To post to this group, send email to flutt...@googlegroups.com.

alvaro arcas

unread,
May 20, 2016, 4:26:20 PM5/20/16
to Flutter Dev

MacBook-Pro-de-Alvaro:examples arcas$ flutter doctor

[✓] Flutter (on Mac OS, channel alpha)

    • Flutter at /Users/arcas/dart/flutter/flutter

    • Framework revision cc93170894 (11 days ago), engine revision 98f020ff2d


[✓] Android toolchain - develop for Android devices (Android SDK 24.0.0-preview)

    • Android SDK at /Users/arcas/Library/Android/sdk

    • Platform android-N, build-tools 24.0.0-preview

    • Java(TM) SE Runtime Environment (build 1.8.0_11-b12)


[✓] iOS toolchain - develop for iOS devices (Xcode 7.3.1)

    • XCode at /Applications/Xcode.app/Contents/Developer

    • Xcode 7.3.1, Build version 7D1014

    x ideviceinstaller not available; this is used to discover connected iOS devices.

      Install via 'brew install ideviceinstaller'.

    x ios-deploy not available; this is used to deploy to connected iOS devices.

      Install via 'brew install ios-deploy'.


[✓] Atom - a lightweight development environment for Flutter

    • Atom installed; Flutter plugin version 0.2.2

Eric Seidel

unread,
May 20, 2016, 4:28:58 PM5/20/16
to alvaro arcas, Flutter Dev, Devon Carew
I suspect that the version of flutter in your path:
/Users/arcas/dart/flutter/flutter

May be different from the version of flutter pointed to by your
pubspec in your project?

It sounds like the one your project is pointing to (you can see in the
pubspec.yaml) may be out of date.
> https://groups.google.com/d/msgid/flutter-dev/1cd60a59-fc1c-4887-9652-386a2cddae63%40googlegroups.com.

alvaro arcas

unread,
May 20, 2016, 4:40:22 PM5/20/16
to Flutter Dev
Thats what i thougth but i have change the path in the pubspect and there is no way no get it working.
I have used Marius solution and it work.
But no home parameter was recognize in the constructor MaterialApp.

I have a off topic question. Will dart replace java on android in the future? i know that a lot of people is asking this question.
Thanks

Seth Ladd

unread,
May 20, 2016, 4:45:05 PM5/20/16
to alvaro arcas, Flutter Dev
Hi Alvaro,

On Fri, May 20, 2016 at 1:40 PM, alvaro arcas <arca...@gmail.com> wrote:
Thats what i thougth but i have change the path in the pubspect and there is no way no get it working.
I have used Marius solution and it work.
But no home parameter was recognize in the constructor MaterialApp.

I have a off topic question. Will dart replace java on android in the future? i know that a lot of people is asking this question.

We're not on the Android team, so we can't comment or speak for them.

Thanks for reaching out with your feedback. Sorry you've been running into issues, hope we can resolve them for you soon.

Seth
 
Thanks

El viernes, 20 de mayo de 2016, 19:41:45 (UTC+2), alvaro arcas escribió:
Hi, im new at flutter and i am trying to use the new tutorial of the code labs but the app does not run because MaterialApp constructor does not have a home parameter.
Any idea? What im doing wrong?
Thanks.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To post to this group, send email to flutt...@googlegroups.com.

Ian Hickson

unread,
May 20, 2016, 4:48:52 PM5/20/16
to Seth Ladd, alvaro arcas, Flutter Dev
Can you paste the pubspec.yaml file and tell us what the absolute path to it is?

alvaro arcas

unread,
May 20, 2016, 4:51:52 PM5/20/16
to Flutter Dev
Sure, this is the pubspec
name: myfirechat
description: Create a new Flutter project.
dependencies:
  flutter:
    path: /Users/arcas/dart/flutter/packages/flutter

The path of flutter is  /Users/arcas/dart/flutter/

The flutter root path configured on atom is /Users/arcas/dart/flutter/


El viernes, 20 de mayo de 2016, 19:41:45 (UTC+2), alvaro arcas escribió:

Eric Seidel

unread,
May 20, 2016, 4:54:21 PM5/20/16
to alvaro arcas, Flutter Dev
Your flutter doctor output said "/Users/arcas/dart/flutter/flutter",
so I would expect your flutter: path in your pubspec to be:

/Users/arcas/dart/flutter/flutter/packages/flutter

Note the double flutter.
> --
> You received this message because you are subscribed to the Google Groups
> "Flutter Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to flutter-dev...@googlegroups.com.
> To post to this group, send email to flutt...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/flutter-dev/19bc7436-89f7-476a-9810-3a102ad56448%40googlegroups.com.

alvaro arcas

unread,
May 20, 2016, 5:08:10 PM5/20/16
to Flutter Dev
You were right eseidel so sorry for my fault and thanks for all.

El viernes, 20 de mayo de 2016, 19:41:45 (UTC+2), alvaro arcas escribió:

Eric Seidel

unread,
May 20, 2016, 5:14:12 PM5/20/16
to alvaro arcas, Flutter Dev
Your'e not the first person to hit this issue. It's something
`flutter doctor` needs to detect and warn about.

Sorry for the trouble. I've filed
https://github.com/flutter/flutter/issues/4085 for followup.
> --
> You received this message because you are subscribed to the Google Groups
> "Flutter Dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to flutter-dev...@googlegroups.com.
> To post to this group, send email to flutt...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/flutter-dev/7570f3a4-118d-44da-b8b9-7ac1cfcdd796%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages