Pretty new to programming and very new to dart/flutter.
The properties of an object of one class are needed to construct an object of another class. I try constructing to the object of the independent class first and defining the property, then follow by constructing an object of the second class and passing it's constructor the property from first class as parameter. I get the following error,
Error Message: Instance member 'x' can't be accessed in an initializer
EDIT: typo in 3rd line of code has been changed
Example:
void main(){
Class1 instanceOfClass1 = Class1(property_A: 10);
Class2 instanceOfClass2 = Class2(property_B: instanceOfClass1.property_A)
}
class Class1 {
var property_A;
Class1({required this.property_A});
}
class Class2 {
var property_B;
Class2({required this.property_B});
}