Define const level class in Flutter - dart

I want define a class Const to reuse and easier to handle edit, manternance. Example:
My issue screenshot
But Dart Analysis has 2 warnings such as:
error: The const variable 'String' must be initialized.
error: Expected to find ';'.

There's isn't any line #5 in your class, neither any String variable. Try refreshing your IDE
Perhaps the log you are getting is from some previous build!

Related

Nestjs TypeError: applicationConfig.getVersioning is not a function

I have reinstalled #nestjs/swagger and swagger-ui-express. All my dependencies are up to date. But I get this error:
applicationConfig.getVersioning is not a function at SwaggerExplorer.exploreRoutePathAndMethod
I have updated metadata tags in tsconfig.ts file as well. After debugging, I can find that the main issue is at line where createDocument function is called from Swagger Module class. Every code line before that works fine.
On console logging, I even could extract the values of config-correctly. However, once the createDocument method is called, the API comes to a crashing halt with the above stated error.
/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:125
const controllerVersion = this.getVersionMetadata(metatype, applicationConfig.getVersioning());
^
TypeError: applicationConfig.getVersioning is not a function
at SwaggerExplorer.exploreRoutePathAndMethod (/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:125:87)
at /home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:72:45
at Array.reduce ()
at /home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:71:99
at /home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:13469:38
at /home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:4967:15
at baseForOwn (/home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:3032:24)
at Function.mapValues (/home/prasanna/my_project/TapisProject/API/API/node_modules/lodash/lodash.js:13468:7)
at MapIterator.iteratee (/home/prasanna/my_project/TapisProject/API/API/node_modules/#nestjs/swagger/dist/swagger-explorer.js:71:45)
at MapIterator.next (/home/prasanna/my_project/TapisProject/API/API/node_modules/iterare/src/map.ts:9:39)
need to upgrade #nestjs/core as well –

How to modify a specific derivation option in nix package manager

I want to modify the definition of a Nix derivation (emacs macport). I wish to change the configureFlag value and "--with-mac-metal" to it.
I have tried the following with no luck:
emacsMacport.overrideDerivation
(old: {
configureFlags = [
"LDFLAGS=-L${ncurses.out}/lib"
"--with-xml2=yes"
"--with-gnutls=yes"
"--with-mac"
"--with-modules"
"--enable-mac-app=$$out/Applications"
"--with-mac-metal"
];
})
I am using home-manager and nix-darwin, and I get the following exception:
error: A definition for option `home-manager.users.ashk.home.packages.[definition 16-entry 3]' is not of type `package'. Definition values:
- In `/nix/store/mkcwa9i9brbxf81a01whhy53yzk87c9d-source/modules/hosts/zebra/home.nix': <function>
(use '--show-trace' to show detailed location information)
You need to parenthesize function applications when they're in a list literal.
It's weird.
You'll probably never get used to this, judging from my own experience using Nix extensively for years.

Am I using TextLoader wrong when running the ML.Net Iris demo in F#?

I am new to F#/.NET and I am trying to run the F# example provided in the accepted answer of How to translate the intro ML.Net demo to F#? with the ML.NET library, using F# on Visual Studio, using Microsoft.ML (0.2.0).
When building it I get the error error FS0039: The type 'TextLoader' is not defined.
To avoid this, I added the line
open Microsoft.ML.Data
to the source.
Then, however, the line
pipeline.Add(new TextLoader<IrisData>(dataPath,separator = ","))
triggers:
error FS0033: The non-generic type 'Microsoft.ML.Data.TextLoader' does not expect any type arguments, but here is given 1 type argument(s)
Changing to:
pipeline.Add(new TextLoader(dataPath,separator = ","))
yields:
error FS0495: The object constructor 'TextLoader' has no argument or settable return property 'separator'. The required signature is TextLoader(filePath: string) : TextLoader.
Changing to:
pipeline.Add(new TextLoader(dataPath))
makes the build successful, but the code fails when running with
ArgumentOutOfRangeException: Column #1 not found in the dataset (it only has 1 columns), I assume because the comma separator is not correctly picked up (incidentally, you can find and inspect the iris dataset at https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data).
Also
pipeline.Add(new TextLoader(dataPath).CreateFrom<IrisData>(separator: ','))
won't work.
I understand that there have been changes in TextLoader recently (see e.g. https://github.com/dotnet/machinelearning/issues/332), can somebody point me to what I am doing wrong?
F# just has a bit of a different syntax that can take some getting used to. It doesn't use the new keyword to instantiate a new class and to use named parameters it uses the = instead of : that you would in C#.
So for this line in C#:
pipeline.Add(new TextLoader(dataPath).CreateFrom<IrisData>(separator: ','))
It would be this in F#:
pipeline.Add(TextLoader(dataPath).CreateFrom<IrisData>(separator=','))

What Is the Replacement for the #Decorator Directive?

I'm upgrading my dart code from angular 1 to angular 4.
This line now gives an error in my IDE:
#Decorator(selector: '[citable]')
Annotation must either be a const variable or const construction invocation.
I was able to fix this error on #Input by including the formDirective. What directive should I use for #Decoration? I can't find any recent mention of #Decorator in a web search for AngularDart.
I tried adding const after selector:. Then I get a syntax error.
The replacement is #Directive.

Dart Editor: "unused import" errors

For a project, I'm importing a library but I don't use any of the classes in it directly. The goal is to fetch a ClassMirror at runtime to create an instance from it. So I have something like:
import 'controllers.dart';
main() {
ClassMirror controller = getClassFromString(libraryName: 'deck_app', className: 'HomeController');
InstanceMirror instance = controller.newInstance(new Symbol(''), []);
instance.reflectee.sayHey();
}
This gives me an "unused import" error. Idk if this is to be considered a bug. So I'm asking you: do you think this is to be considered as a bug? If not, is there a way I could suppress unused import errors?
What's weird is I thought Dart would tree-shake the source and remove the unused import's code, but it does not. The library is properly imported and available.
The unused import is just a conclusion from the static analyzer. You can ignore it or add a dummy statement to silence the analyzer. This has no effect when you run the application.

Resources