Update of didChangeDependencies (Flutter)

I have a Dashboard homepage that allows me to access another page called Brand.

GoRoute(
          name: DashboardPage.routeName,
          path: DashboardPage.routeName,
          builder: (context,state) => const DashboardPage(),
          routes: [
            GoRoute(
              name: BrandPage.routeName,
              path: BrandPage.routeName,
              builder: (context,state) => const BrandPage(),
            )

My goal is to be able to add a new brand on the Brand page, send the name of this brand to my database, and then have my page (in the form of a ListView) refresh instantly to show the newly added brand.

To optimize the functioning of this system, I have two functions,:

addBrand to add a new brand to my database (in a file Db_helper):

static Future<void> addBrand(Brand brand) {
    final doc = _db.collection(collectionBrand).doc();
    brand.id = doc.id;
    return doc.set(brand.toMap());
}

getAllBrands to retrieve all the brands from my database and stock them in a list defined in my provider:

getAllBrands() {
    DbHelper.getAllBrands().listen((snapshot) {
      brandList = List.generate(snapshot.docs.length, (index) => Brand.fromMap(snapshot.docs[index].data()));
    });
    notifyListeners();
  }

To try to solve my problem, it seems that I simply need to call my getAllBrands function at the “right moment” and then display all the elements of the brandList in my ListView.

Consumer<TelescopeProvider>(
        builder: (context, provider, child) =>
        provider.brandList.isEmpty
            ? const Center(child: Text("Brand Not Found"))
            : ListView.builder(
          itemCount: provider.brandList.length,
          itemBuilder: (context, index) {
            final brand = provider.brandList[index];
            return ListTile(
              title: Text(brand.name),
            );
          },
        ),
      )

To avoid constantly regenerating my data, I decided to refresh my data whenever there are changes in the dependencies of the Dashboard (I want to access other pages besides Brand, so I want to centralize everything in the Dashboard). Therefore, I wrote in DashboardPage:

@override void didChangeDependencies() { 
Provider.of<TelescopeProvider>(context, listen: false).getAllBrands(); super.didChangeDependencies(); 
}

However, every time I add an element in Brand, the page does not update immediately; I have to return to the Dashboard and then go back to Brand to see my new list.

I think I understand why this is happening because when I return to the Dashboard from Brands, the Dashboard is reconstructed, which calls the didChangeDependencies function. However, when I stay on Brand and add my element, there is no change in context, and thus didChangeDependencies is not triggered.

Yet, I saw a video doing the same thing, and Brand was updating directly. Therefore, I am a bit lost both on the conditions that cause didChangeDependencies to be called and especially on how to solve my problem.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật