Home > Mobile >  What does '!const' do in Dart?
What does '!const' do in Dart?

Time:12-20

I came across documentation wiki for @pragma("vm:entry-point") on Github. It mentions following code snippet:

@pragma("vm:entry-point")
@pragma("vm:entry-point", true/false)
@pragma("vm:entry-point", !const bool.fromEnvironment("dart.vm.product"))
class C { ... }

I know about const keyword in Dart. But, what does !const do? Is it just to declare that the property is not a constant? Where can I read about its usage and functionality in official documentation?

CodePudding user response:

I think it means the following:

!(const bool.fromEnvironment("dart.vm.product"))

I think it means the negative of the bool result.

Two examples:

Code:

print(!true);

Result:

false

Code:

print(!false);

Result:

true
  • Related