"#required" annotation as error instead of warning - dart

Right now in my Flutter project when I annotate a constructor parameter with #required and forget it when instantiating the constructor, I get a light warning from my IDE that the parameter is required.
I would like this to show up as an actual error from the IDE. Is there a way in analysis_options.yaml or somewhere else to set it as error instead of warning?

In analysis_options.yaml add
analyzer:
errors:
missing_required_param: error
before
$ flutter analyze
Analyzing flutter_0_generic...
info • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 2.2s)
after
$ flutter analyze
Analyzing flutter_0_generic...
error • The parameter 'onPressed' is required • lib/main.dart:49:33 • missing_required_param
1 issue found. (ran in 1.8s)
See also https://www.dartlang.org/guides/language/analysis-options#changing-the-severity-of-analysis-rules

Related

Flutter run - Failed to build iOS app - Command PhaseScriptExecution failed with a nonzero exit code

Here's an image version of the console output for the flutter run.
Here's an image version of the console output for flutter doctor -v.
Running flutter run gives me:
'''Downloading ios tools... 7.8s
Downloading ios-profile tools... 5.5s
Downloading ios-release tools... 34.0s
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App
Store.
Running pod install... 9.3s
Running Xcode build...
Xcode build done. 89.9s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type
'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type
'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type
'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type
'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method
'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
- 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart'
('../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no
method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone SE (2nd generation).
'''
Running flutter doctor -v gives me:
'''
Downloading android-arm-profile/darwin-x64 tools... 1.1s
Downloading android-arm-release/darwin-x64 tools... 0.9s
Downloading android-arm64-profile/darwin-x64 tools... 1.7s
Downloading android-arm64-release/darwin-x64 tools... 1.0s
Downloading android-x64-profile/darwin-x64 tools... 1.3s
Downloading android-x64-release/darwin-x64 tools... 1.0s
[✓] Flutter (Channel master, 1.20.0-1.0.pre.132, on Mac OS X 10.15.2 19C57, locale en-US)
• Flutter version 1.20.0-1.0.pre.132 at /Users/lesleychang/flutter
• Framework revision 5995661777 (6 hours ago), 2020-06-19 16:15:58 -0700
• Engine revision 676cd566f7
• Dart version 2.9.0 (build 2.9.0-17.0.dev 7e72c9ae7e)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] Connected device (1 available)
• iPhone SE (2nd generation) • 7305F6FC-57BD-4A00-A55D-FC6741E759C4 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
! Doctor found issues in 2 categories.
'''
I can't run my Flutter app on my iOS emulator at all and I've looked at similar posts to no avail. Any pointers on what to do? Or any other communities I can try getting help from? Thanks!
Due to a breaking change made by https://github.com/flutter/flutter/pull/58635, you can upgrade flutter_svg to 0.18.0 or downgrade flutter otherwise.
upgrade your flutter_svg plugin to
flutter_svg: ^0.19.0

Built value generator fails

Since this morning, the generation step of built value (pub run build_runner build) is failing with
[SEVERE] built_value_generator:built_value on lib/client.dart (cached):
Unknown error in BuiltValueGenerator for myproject|lib/client.dart.
NoSuchMethodError: The method 'getParsedLibraryByElement' was called on null.
Receiver: null
Tried calling: getParsedLibraryByElement(Instance of 'LibraryElementImpl')
I tried upgrading to built value 6.6.0 (from 6.3.2), but it didn't help
Dart version is 2.1.0-dev.9.4
Any suggestions are welcome

Problem with "multi_image_picker" in dart

I have the problem with library minSdk: Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk version to at least 19
I Changed the build.gradle in the section minSdkVersion but show this:
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.prueba_2"
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\6.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\7.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\8.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\9.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\10.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\11.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\12.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\13.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\14.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\15.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\16.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\17.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\18.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\19.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\20.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\21.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\22.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\23.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\24.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\25.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\26.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\27.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\28.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\29.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\30.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\31.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\32.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\33.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\34.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\35.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\36.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\37.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\38.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\39.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\40.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\41.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\42.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\43.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\44.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\45.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\46.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\47.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\48.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\49.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\50.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\51.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\52.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\53.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\54.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\55.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\56.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\57.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\58.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\59.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\60.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\61.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\62.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\63.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\64.jar, C:\Users\ANALYSIC-NABLA\Documents\Flutter\Development\prueba_2\build\app\intermediates\transforms\dexBuilder\debug\65.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel$Stub
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.706], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.3)
[√] VS Code (version 1.33.1)
[√] Connected device (1 available)
• No issues found!
This plugin was migrated from using the deprecated Android Support Library to AndroidX. If your project was migrated to use it as well you should install version 4.X.X of the plugin. If you are using the old project structure please use version 2.4.11
Had the same problem.
tried to migrate to AndroidX using this method as suggested by flutter documentation :
1.tried menu Refactor > Migrate to AndroidX
2.got "No usages found"
I still had the error , so i tried the solution in this link (using the selected answer) :
[Flutter Projects & Android X Migration Issues
And it worked perfectly

dartanalyzer reports errors on the getting started tutorial

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?
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.

Failed to check license ilog.rules.res.xu.IlrLocalizedResourceException: error code: XU.ERROR.10700

I am trying to execute iLog jRules (Version 7.1) from Plain Java program. I am using J2SE session factory. Still I am getting below error. Can someone please enlighten ? Also what is the best and simple way to execute jRules rules from java main method ?
6/9/14 4:48 PM [SEVERE] 10700 - -.- - Failed to check license ilog.rules.res.xu.IlrLocalizedResourceException: Failed to check license, error code: XU.ERROR.10700
at ilog.rules.res.xu.util.IlrResourceExceptionHelper.createResourceException(IlrResourceExceptionHelper.java:44)
at ilog.rules.res.xu.util.IlrResourceExceptionHelper.createResourceException(IlrResourceExceptionHelper.java:78)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.verifyRESLicense(IlrManagedXUConnectionFactory.java:1108)
at ilog.rules.res.xu.spi.IlrManagedXUConnectionFactory.getRulesetProvider(IlrManagedXUConnectionFactory.java:883)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getRulesetProvider(IlrManagedXUConnection.java:280)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.createEngineManager(IlrManagedXUConnection.java:1659)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getEngineManager(IlrManagedXUConnection.java:1591)
at ilog.rules.res.xu.spi.IlrManagedXUConnection.getRulesetParameters(IlrManagedXUConnection.java:1508)
at ilog.rules.res.xu.cci.IlrXUConnection.getRulesetParameters(IlrXUConnection.java:499)
at ilog.rules.res.xu.cci.IlrXUInteraction.getRulesetInformation(IlrXUInteraction.java:739)
at ilog.rules.res.xu.cci.IlrXUInteraction.dispatchExecution(IlrXUInteraction.java:185)
at ilog.rules.res.xu.cci.IlrXUInteraction.execute(IlrXUInteraction.java:343)
at ilog.rules.res.xu.cci.IlrXUInteraction.execute(IlrXUInteraction.java:459)
at ilog.rules.res.xu.cci.IlrCCIClient.executeInteraction(IlrCCIClient.java:189)
at ilog.rules.res.xu.cci.IlrCCIRuleEngineClient.getRulesetArchiveProperties(IlrCCIRuleEngineClient.java:699)
at ilog.rules.res.session.util.IlrTraceHelper.<init>(IlrTraceHelper.java:111)
at ilog.rules.res.session.impl.IlrStatelessSessionBase.execute(IlrStatelessSessionBase.java:97)
at poc.PojoClientRunnerImpl.executeentpocrules(PojoClientRunnerImpl.java:88)
at poc.Main.main(Main.java:28)
Caused by: ilog.jum.client700.IluSAMAccessDeniedException: At 2014-06-09 11:18:33 GMT, SAM 3.0.0.1040: Access denied to module 'RES4J'.
If you want to inspect your access key, please do the following:
java -cp [location]sam.jar ilog.jum.client700.IluSAMAccessKey -summary
I got this issue resolved. It was because jar version mismatch. I was using jRules Studio version 7.1.1 and was executing using jRules version 7.0.0 jars .
I modified my classpath to use version 7.1.1 jars for jRules version 7.1.1 rule studio.

Resources