Q: How to dynamically change the title of screen I want to pass the title data from one screen (ChatModel.dart) to another one.
I created a Model that includes the topic, which in this case is the title of the screen.
This is the model code:
class User {
  final int id;
  final String topic;
  final String imageUrl;
  final bool isThereNewMessages;

  User({
    this.id,
    this.topic,
    this.imageUrl,
    this.isThereNewMessages,
  });
}

final User Members = User(
  id: 0,
  topic: 'New Members',
  imageUrl: 'https://...',
  isThereNewMessages: true,
);

final User Sell = User(
  id: 1,
  topic: 'Sell and Buy',
  imageUrl: 'https://i....',
  isThereNewMessages: true,
);

What I need to do is to access dinamically to the topic in each screen.
I've created a variable to access to the User model:
 final chat = User;

and imported the file.
Then I am accessing by doing this:
Text(
            User.topic,
            textScaleFactor: 1.5,
            style: TextStyle(fontWeight: FontWeight.bold),
          ),

Its not working. How should I pass the data?

A: You are accessing the User constructor instead of the Members variable.
Change
final chat = User;
To
final chat = Member;
Then
Text(
            chat.topic,
            textScaleFactor: 1.5,
            style: TextStyle(fontWeight: FontWeight.bold),
          ),

