Issue I am new to android and java and i can not get my head around understanding why in android “this” keyword is sometimes used and not “super”? Also how can you call parent methods without “this” or “super” keyword.
Continue readingTag: inheritance
How can I have common views and code in a parent class and re-utilize them in child Fragments?
Issue I have 3 fragments that have 5 common components: 1 TextView, 2 Button, 1 ProgressBar. Instead of calling findViewById, setText or setOnClickListener methods on each fragment with the same code (see below), I want to have this code in
Continue readingHow to make an overridden function private in Dart?
Issue There is a _ operator which makes a property private. Eg: _hidden() This hides the property outside of the file. Now if I have a Parent class with func() in the file parent.dart. A Child class extends the Parent
Continue readingDart standardizing logic of child class clone methods using existing Map methods
Issue I am trying to standardize the logic of a class.clone method so that every child of my abstract class clones the exact same way. I’ve tried using factory constructors and all sorts of roundabouts but I can’t seem to
Continue readinghow to override a setter of an abstract class to make the value final
Issue Given an abstract class "Foo" that has a getter and setter for a "value" abstract class Foo<T> { T get value; set value(T newValue); } I’m trying to override getter and setter to make the value final; with the
Continue readingDart abstract static method
Issue I want to create an abstract Sort class for my class project using dart which I will extend with Sorting algorithm classes like MergeSort, QuickSort, Heap, etc. I wrote the below code but I cannot create an abstract static
Continue readingFlutter/Dart: reaction of ui depending on the inheritance class of an object
Issue I have a class for menu-entries: abstract class MenuSelection { MenuSelection({required this.label}); final String label; } and two classes that inherit from this class: ///for menu entries with an image abstract class ImageSelection extends MenuSelection { ImageSelection({required this.image, required
Continue readingHow to properly use Dart encapsulation in inheritance
Issue Encapsulation says you should use private attributes, but this brought me an issue. I cannot access super-class attributes in my sub-class. I’ve readed that if classes are in different files, you cannot read them if their private, so should
Continue readingHow to reuse non Widget classes in Flutter?
Issue I know we are supposed to use composition over inheritance in Flutter. And that works great when we are talking about Widgets. But what am I supposed to do when a class is not a Widget? For example, I
Continue readingHow to make inheritance hierarchy for Type Converter of Dart Floor?
Issue As below, I define ListConverter<T> to make inheritance hierarchy. abstract class ListConverter<T> extends TypeConverter<List<T>, String> { static const delimiter = "!DELIMITER!"; T fromDB(String databaseValue); String toDB(T value); @override List<T> decode(String databaseValue) { return databaseValue .split(delimiter) .where((element) => element.isNotEmpty) .map((e)
Continue reading