Reputation: 1752
I just want to add widgets to ListView dynamically when an event occurs. So What I do is created an array set the first element when an event occurs I will update the list and it will change the UI. but I got The instance member 'localVideoRenderer' can't be accessed in an initializer. Try replacing the reference to the instance member with a different expression
RTCVideoRenderer _localVideoRenderer = RTCVideoRenderer();
var renders = [];
final List<Widget> names =
[
Container(
key: new Key("local"),
margin: new EdgeInsets.fromLTRB(5.0, 5.0, 5.0, 5.0),
decoration: new BoxDecoration(color: Colors.black),
child: RTCVideoView(_localVideoRenderer),
),
];
Upvotes: 0
Views: 174
Reputation: 2447
You are trying to access an instance variable in another instance variable in the initializer.
Try initializing names
to an empty list by default and update it within a overridden function void initState()
Upvotes: 1