-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[Write your first Flutter app codelab] Remove const isn't mentioned #4369
Comments
For Problem flutter/flutter#2 above, it seems that .asPascalCase is available only after running in the android emulator. Initially I was running on "Web Server (web)" which gave the error. After I run on android emulator, the "Web Server (web)" device no longer had the error and worked as expected. |
Hi @jshrek
logsimport 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
// https://github.com/flutter/codelabs/tree/b3293b5bb0c0187bdbe8112f7759f4d75f4c040a/startup_namer/step2_use_package
// from https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1/#3 bottom page
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final wordPair = WordPair.random();
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
child: Text(wordPair.asPascalCase),
),
),
);
}
} it seems to work as intended logs nevercode@Nevercodes-Air ~/Desktop/projects/twentyseven_march flutter_dev run -d chrome --verbose ✔ 753 09:06:41
[ +27 ms] executing: [/Users/nevercode/development/flutter_dev/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +57 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 58cad787d89cc12e72f1f0ec3f1df6a9796ef029
[ ] executing: [/Users/nevercode/development/flutter_dev/] git describe --match v*.*.* --first-parent --long --tags
[ +23 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v1.16.2-0-g58cad787d
[ +10 ms] executing: [/Users/nevercode/development/flutter_dev/] git rev-parse --abbrev-ref --symbolic @{u}
[ +17 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/dev
[ ] executing: [/Users/nevercode/development/flutter_dev/] git ls-remote --get-url origin
[ +17 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +92 ms] executing: [/Users/nevercode/development/flutter_dev/] git rev-parse --abbrev-ref HEAD
[ +17 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ +1 ms] dev
[ +8 ms] executing: sw_vers -productName
[ +33 ms] Exit code 0 from: sw_vers -productName
[ ] Mac OS X
[ ] executing: sw_vers -productVersion
[ +21 ms] Exit code 0 from: sw_vers -productVersion
[ +1 ms] 10.15.4
[ ] executing: sw_vers -buildVersion
[ +24 ms] Exit code 0 from: sw_vers -buildVersion
[ ] 19E266
[ +42 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +27 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb devices -l
[ +17 ms] executing: /usr/bin/xcode-select --print-path
[ +12 ms] Exit code 0 from: /usr/bin/xcode-select --print-path
[ ] /Applications/Xcode.app/Contents/Developer
[ +2 ms] executing: /usr/bin/xcodebuild -version
[+1333 ms] Exit code 0 from: /usr/bin/xcodebuild -version
[ +3 ms] Xcode 11.3.1
Build version 11C504
[ +5 ms] executing: xcrun --find xcdevice
[ +20 ms] Exit code 0 from: xcrun --find xcdevice
[ ] /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice
[ ] executing: xcrun xcdevice list --timeout 1
[ +5 ms] /usr/bin/xcrun simctl list --json devices
[ ] executing: /usr/bin/xcrun simctl list --json devices
[ +74 ms] List of devices attached
[ +210 ms] {
"devices" : {
"com.apple.CoreSimulator.SimRuntime.watchOS-6-1" : [
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple Watch Series 4 - 40mm",
"udid" : "7F389A7F-C267-412A-8DB8-63A83386A06F"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple Watch Series 4 - 44mm",
"udid" : "3568E5A3-98A0-414B-9A79-5CC234FA6E2B"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple Watch Series 5 - 40mm",
"udid" : "3B543693-444A-4E3D-BD8A-9BD2AE2EDD2F"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple Watch Series 5 - 44mm",
"udid" : "AF6A4F31-535E-4FE6-A062-49A81AB5AAE3"
}
],
"com.apple.CoreSimulator.SimRuntime.tvOS-13-3" : [
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple TV",
"udid" : "8EC4E84F-BA3E-4251-8351-8324AC08E126"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple TV 4K",
"udid" : "8FFD5279-9EEA-49AE-83CA-8736CB3E61AB"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "Apple TV 4K (at 1080p)",
"udid" : "8A1D2EC5-B2B9-474D-81DF-E6A3D0DB84EF"
}
],
"com.apple.CoreSimulator.SimRuntime.iOS-13-3" : [
{
"state" : "Booted",
"isAvailable" : true,
"name" : "iPhone 8",
"udid" : "D5F70F31-B488-4454-9539-320B5551D92A"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPhone 8 Plus",
"udid" : "62B827A3-68BD-46BD-8E92-DE5297DF3840"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPhone 11",
"udid" : "D1B95CB0-D10B-4983-9AFE-6DB7C4006D15"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPhone 11 Pro",
"udid" : "8B67BA47-2EED-4956-B383-17112E09F7BC"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPhone 11 Pro Max",
"udid" : "A1664A8D-8DB6-4659-B012-18746A2DB8C3"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPad Pro (9.7-inch)",
"udid" : "A7BC437A-C1AB-4DDC-B723-5BC2411FF606"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPad (7th generation)",
"udid" : "50905834-EA49-46D1-9282-2BFD80B002C9"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPad Pro (11-inch)",
"udid" : "C37B8020-20B5-44D3-BB6B-1E34569A3E57"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPad Pro (12.9-inch) (3rd generation)",
"udid" : "BBD1E939-BE74-444C-825D-6DA528EF37D0"
},
{
"state" : "Shutdown",
"isAvailable" : true,
"name" : "iPad Air (3rd generation)",
"udid" : "609AAB06-1510-466F-82F8-1951E7EAFCD2"
}
]
}
}
[+3609 ms] [
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17K446)",
"available" : true,
"platform" : "com.apple.platform.appletvsimulator",
"modelCode" : "AppleTV6,2",
"identifier" : "8FFD5279-9EEA-49AE-83CA-8736CB3E61AB",
"architecture" : "x86_64",
"modelName" : "Apple TV 4K",
"name" : "Apple TV 4K"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPad8,1",
"identifier" : "C37B8020-20B5-44D3-BB6B-1E34569A3E57",
"architecture" : "x86_64",
"modelName" : "iPad Pro (11-inch)",
"name" : "iPad Pro (11-inch)"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17K446)",
"available" : true,
"platform" : "com.apple.platform.appletvsimulator",
"modelCode" : "AppleTV6,2",
"identifier" : "8A1D2EC5-B2B9-474D-81DF-E6A3D0DB84EF",
"architecture" : "x86_64",
"modelName" : "Apple TV 4K (at 1080p)",
"name" : "Apple TV 4K (at 1080p)"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPhone12,5",
"identifier" : "A1664A8D-8DB6-4659-B012-18746A2DB8C3",
"architecture" : "x86_64",
"modelName" : "iPhone 11 Pro Max",
"name" : "iPhone 11 Pro Max"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPad6,4",
"identifier" : "A7BC437A-C1AB-4DDC-B723-5BC2411FF606",
"architecture" : "x86_64",
"modelName" : "iPad Pro (9.7-inch)",
"name" : "iPad Pro (9.7-inch)"
},
{
"simulator" : true,
"operatingSystemVersion" : "6.1.1 (17S445)",
"available" : true,
"platform" : "com.apple.platform.watchsimulator",
"modelCode" : "Watch4,4",
"identifier" : "3568E5A3-98A0-414B-9A79-5CC234FA6E2B",
"architecture" : "i386",
"modelName" : "Apple Watch Series 4 - 44mm",
"name" : "Apple Watch Series 4 - 44mm"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPad11,3",
"identifier" : "609AAB06-1510-466F-82F8-1951E7EAFCD2",
"architecture" : "x86_64",
"modelName" : "iPad Air (3rd generation)",
"name" : "iPad Air (3rd generation)"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17K446)",
"available" : true,
"platform" : "com.apple.platform.appletvsimulator",
"modelCode" : "AppleTV5,3",
"identifier" : "8EC4E84F-BA3E-4251-8351-8324AC08E126",
"architecture" : "x86_64",
"modelName" : "Apple TV",
"name" : "Apple TV"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPhone10,4",
"identifier" : "D5F70F31-B488-4454-9539-320B5551D92A",
"architecture" : "x86_64",
"modelName" : "iPhone 8",
"name" : "iPhone 8"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPad8,5",
"identifier" : "BBD1E939-BE74-444C-825D-6DA528EF37D0",
"architecture" : "x86_64",
"modelName" : "iPad Pro (12.9-inch) (3rd generation)",
"name" : "iPad Pro (12.9-inch) (3rd generation)"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPhone12,3",
"identifier" : "8B67BA47-2EED-4956-B383-17112E09F7BC",
"architecture" : "x86_64",
"modelName" : "iPhone 11 Pro",
"name" : "iPhone 11 Pro"
},
{
"simulator" : true,
"operatingSystemVersion" : "6.1.1 (17S445)",
"available" : true,
"platform" : "com.apple.platform.watchsimulator",
"modelCode" : "Watch5,3",
"identifier" : "3B543693-444A-4E3D-BD8A-9BD2AE2EDD2F",
"architecture" : "i386",
"modelName" : "Apple Watch Series 5 - 40mm",
"name" : "Apple Watch Series 5 - 40mm"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPhone10,5",
"identifier" : "62B827A3-68BD-46BD-8E92-DE5297DF3840",
"architecture" : "x86_64",
"modelName" : "iPhone 8 Plus",
"name" : "iPhone 8 Plus"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPhone12,1",
"identifier" : "D1B95CB0-D10B-4983-9AFE-6DB7C4006D15",
"architecture" : "x86_64",
"modelName" : "iPhone 11",
"name" : "iPhone 11"
},
{
"simulator" : true,
"operatingSystemVersion" : "13.3 (17C45)",
"available" : true,
"platform" : "com.apple.platform.iphonesimulator",
"modelCode" : "iPad7,12",
"identifier" : "50905834-EA49-46D1-9282-2BFD80B002C9",
"architecture" : "x86_64",
"modelName" : "iPad (7th generation)",
"name" : "iPad (7th generation)"
},
{
"simulator" : true,
"operatingSystemVersion" : "6.1.1 (17S445)",
"available" : true,
"platform" : "com.apple.platform.watchsimulator",
"modelCode" : "Watch4,3",
"identifier" : "7F389A7F-C267-412A-8DB8-63A83386A06F",
"architecture" : "i386",
"modelName" : "Apple Watch Series 4 - 40mm",
"name" : "Apple Watch Series 4 - 40mm"
},
{
"simulator" : true,
"operatingSystemVersion" : "6.1.1 (17S445)",
"available" : true,
"platform" : "com.apple.platform.watchsimulator",
"modelCode" : "Watch5,4",
"identifier" : "AF6A4F31-535E-4FE6-A062-49A81AB5AAE3",
"architecture" : "i386",
"modelName" : "Apple Watch Series 5 - 44mm",
"name" : "Apple Watch Series 5 - 44mm"
}
]
[ +14 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +246 ms] Generating /Users/nevercode/Desktop/projects/twentyseven_march/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +378 ms] Launching lib/main.dart on Chrome in debug mode...
[ +61 ms] Updating assets
[ +162 ms] Syncing files to device Chrome...
[ +65 ms] Generating /Users/nevercode/Desktop/projects/twentyseven_march/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +68 ms] <- reset
[ +20 ms] /Users/nevercode/development/flutter_dev/bin/cache/dart-sdk/bin/dart
/Users/nevercode/development/flutter_dev/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root
/Users/nevercode/development/flutter_dev/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names -Ddart.developer.causal_async_stacks=true
--output-dill /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tool.jnMhfA/app.dill --libraries-spec
file:///Users/nevercode/development/flutter_dev/bin/cache/flutter_web_sdk/libraries.json --packages /Users/nevercode/Desktop/projects/twentyseven_march/.packages
-Ddart.vm.profile=false -Ddart.vm.product=false
--bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts
--track-widget-creation --filesystem-root /var/folders/c3/l5jpznsj5k37yrj47l__xpw40000gn/T/flutter_tools.OCGLqC --filesystem-scheme org-dartlang-app --initialize-from-dill
build/cache.dill --platform file:///Users/nevercode/development/flutter_dev/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill
[ +24 ms] <- compile org-dartlang-app:///web_entrypoint.dart
[+18206 ms] Syncing files to device Chrome... (completed in 18,376ms, longer than expected)
[ +1 ms] Synced 21.1MB.
[ +1 ms] <- accept
[+1023 ms] [CHROME]:
[ +1 ms] [CHROME]:DevTools listening on ws://127.0.0.1:51991/devtools/browser/61beafe6-0bee-4daa-8769-6869e759629f
[+5063 ms] Debug service listening on ws://127.0.0.1:52016/qlKjo3FjtjI=
[ +670 ms] Debug service listening on ws://127.0.0.1:52016/qlKjo3FjtjI=
[ +3 ms] Warning: Flutter's support for web development is not stable yet and hasn't
[ ] been thoroughly tested in production environments.
[ ] For more information see https://flutter.dev/web
[ ] 🔥 To hot restart changes while running, press "r". To hot restart (and refresh the browser), press "R".
[ +6 ms] For a more detailed help message, press "h". To quit, press "q".
[+8988 ms] Application finished.
[ +70 ms] Stopped debug service on ws://127.0.0.1:52016 nevertheless I'll leave the issue open to update the steps provided |
I ran into Problem 1 as well. It would also help if the commented out 'Hello World' line had the i.e.
Where is this file located? I would happily submit a pull request but could not find this tutorial doc on GitHub. |
@TahaTesser Are the repo for this file is private to you team members? |
Hi @Pragya007 |
Hey @TahaTesser So if I change these files will it reflect on this page: I am asking for these docs repository. |
@Pragya007 |
@TahaTesser I have already forked it but I could not find this in https://github.com/flutter/codelabs/tree/master/startup_namer/step4_infinite_list/lib I need to change above lines in the doc's code snippet but I think they are not present here.. |
@TahaTesser Hey I think to solve this issue the image of code on: needs to be changed because the code written in lib/main.dart are different from what are shown in the images here in both the pages, and that is what creating a confusion just due the word |
@Pragya007 |
Sure! |
remove const in the body it will work |
body: const Center( ==> body: Center( |
Looking at https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1/#3 the issue with the errant |
On the following page of tutorial, I found the following issues:
https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1/#3
PROBLEM flutter/flutter#1
Following these steps, on this page, gives the following error:
Compiler message:
The issue is that you need to change this line:
body: const Center(
To this line (remove const):
body: Center( // remove const
Please add this to turorial.
PROBLEM flutter/flutter#2
After correcting the above error, I then get this error:
Compiler message:
Apparently it does not recognise asPascalCase by default. To fix it, I changed .asPascalCase to .asString.
But need to add instructions to tutorial on how to make asPascalCase work.
Thanks
The text was updated successfully, but these errors were encountered: