Reputation: 10009
Running dartanalyzer on this snipped found on flutter.io/get-started/codelab yields these errors:
$ dartanalyzer lib/main.dart
Analyzing lib/main.dart...
error • The function 'MyApp' isn't defined at lib/main.dart:3:23 • undefined_function
error • 'MaterialApp' isn't a function at lib/main.dart:8:12 • invocation_of_non_function
error • 'Scaffold' isn't a function at lib/main.dart:10:13 • invocation_of_non_function
error • 'AppBar' isn't a function at lib/main.dart:11:17 • invocation_of_non_function
error • 'Text' isn't a function at lib/main.dart:12:18 • invocation_of_non_function
error • 'Center' isn't a function at lib/main.dart:14:15 • invocation_of_non_function
error • 'Text' isn't a function at lib/main.dart:15:18 • invocation_of_non_function
7 errors found.
$ dartanalyzer --version
dartanalyzer version 1.24.3
What can I do to make the analyzer run correct?
Upvotes: 1
Views: 609
Reputation: 21421
For Flutter projects instead of running dartanalyzer
you should run flutter analyze
. Flutter ships with it's own SDK, so the regular dart analyzer doesn't work without some extra configuration - which that command provides.
Upvotes: 4