Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does @protected mean in dart

As the dev doc says, Dart doesn't have the keywords public , protected , and private . If an identifier starts with an underscore (_), it's private to its library. But I found many @protected keywords in Flutter framework. What does the @protected mean?

abstract class InheritedWidget extends ProxyWidget {
  const InheritedWidget({ Key key, Widget child })
    : super(key: key, child: child);

  @override
  InheritedElement createElement() => InheritedElement(this);

  @protected
  bool updateShouldNotify(covariant InheritedWidget oldWidget);
}
like image 946
Yvan Avatar asked May 15 '20 01:05

Yvan


People also ask

How do you declare a private variable in Dart?

Dart Private Variables In dart, you can declare a variable name with an underscore(_) as a private variable. Private variables are accessed inside the same class, not outside the classes or files. Declared a private variable ie added an underscore before a variable(_) in a class.

What are annotations in Dart?

Annotations in Dart An annotation is a form of representing syntactic metadata that can be added to our Dart code; in other words, a way of adding extra information to any component in our code, such as class or a method.

Which is used to emulate a function in Dart?

The only way to emulate interface in Dart is to create abstract class. That means that in Dart abstract class is mixed with interface.

What is late keyword in Dart?

In Dart, we use the late keyword to declare variables that will be initialized later. These are called non-nullable variables as they are initialized after the declaration. Hence, we use the late keyword. Note: Once we declare a non-nullable late variable, the variable can't be null at runtime.


1 Answers

It's used to provide a hint when members are used outside of subclasses, by the Dart Analyzer.

You can find the issue here.

like image 75
Marcelo Wippel Avatar answered Oct 17 '22 13:10

Marcelo Wippel