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

Container() suddenly requires a positional argument #26275

Closed
bbozo opened this issue Jan 9, 2019 · 9 comments
Closed

Container() suddenly requires a positional argument #26275

bbozo opened this issue Jan 9, 2019 · 9 comments

Comments

@bbozo
Copy link

bbozo commented Jan 9, 2019

I'm going through a flutter tutorial, in one moment the parts of my project that haven't been touched (git status confirms it) started flashing red in Visual Studio Code because Container started to need a positional argument - I thought it might be an IDE error, but flutter run from an independent console gave the same results.

The exact moment when it all broke down I was working on the next lecture in which I added this: https://gist.github.com/bbozo/ade0662a222089117754b901a2096f4b - the new code didn't work, but also the old code had errors reported in it too.

I did git stash locally to revert the new changes, went through steps to clear cache (went through commands in #17937 and https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#corrupted-cache ) but the Container() calls in the old code all now require a positional argument.

I'm stuck :-)

@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 9, 2019
@bbozo
Copy link
Author

bbozo commented Jan 9, 2019

Might be https://github.com/flutter/flutter/wiki/Workarounds-for-common-issues#flutter-installation-corrupted

Correct! :-D Thank you! This somehow happened:

~/opt/flutter (stable) $ git diff
diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart
index 64ce454..ba6d248 100644
--- a/packages/flutter/lib/src/widgets/container.dart
+++ b/packages/flutter/lib/src/widgets/container.dart
@@ -5,6 +5,7 @@
 import 'package:flutter/foundation.dart';
 import 'package:flutter/painting.dart';
 import 'package:flutter/rendering.dart';
+import 'package:flutter/src/material/text_field.dart';
 
 import 'basic.dart';
 import 'framework.dart';
@@ -246,7 +247,7 @@ class Container extends StatelessWidget {
   /// and a `decoration` argument. If you want to have both a `color` and a
   /// `decoration`, you can pass the color as the `color` argument to the
   /// `BoxDecoration`.
-  Container({
+  Container(TextField textField, {
     Key key,
     this.alignment,
     this.padding,

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 9, 2019
@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

Perhaps the IDE you are using is not protecting from modifying SDK source.
This happens actually quite frequently.
What IDE are you working with?

@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

I'm closing this issue because your problem is solved and there are other issues for related problems.
You can still comment of course.

@zoechi zoechi closed this as completed Jan 9, 2019
@bbozo
Copy link
Author

bbozo commented Jan 9, 2019

Perhaps the IDE you are using is not protecting from modifying SDK source.
This happens actually quite frequently.
What IDE are you working with?

I'm using VisualStudio Code:

Version: 1.30.1
Commit: dea8705087adb1b5e5ae1d9123278e178656186a
Date: 2018-12-18T18:07:32.870Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Linux x64 4.13.0-45-generic

it seems this happens often :-)

@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

@DanTup can this be caused by accidental modifications from within the IDE?
Does VSCode prevent editing files in the Flutter directory?

@DanTup
Copy link
Contributor

DanTup commented Jan 9, 2019

can this be caused by accidental modifications from within the IDE?

Yes. Previously this has occurred because the server could generate quick-fixes that modifies the Flutter SDK if you wrote the code incorrectly:

screen shot 2018-12-13 at 1 07 36 pm

This is fixed as part of dart-lang/sdk#35402.

Does VSCode prevent editing files in the Flutter directory?

We can't prevent them but we do show a warning if you manually modify a file outside of your workspace. It wouldn't have caught this though, as the change was made programatically from the quick-fix. Hopefully once the fix rolls out these sorts of issues will stop (in the meantime, running git status in the Flutter SDK folder may be the fastest way to find out if you have dirty files.

@zoechi
Copy link
Contributor

zoechi commented Jan 9, 2019

@DanTup thanks a lot for the update!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants