tGo method

void tGo(
  1. String location, {
  2. Map<String, String>? labels,
  3. Map<String, Object>? extra,
  4. bool push = false,
})

Navigates to a path with optional breadcrumb labels for dynamic segments.

The labels map is used by TBreadcrumbs to display friendly names instead of IDs or slugs in the breadcrumb path.

Example:

context.tGo(
  '/categories/clothes/t-shirt',
  labels: {
    'clothes': 'Fashion',
    't-shirt': 'Premium Tees'
  }
);

Implementation

void tGo(String location, {Map<String, String>? labels, Map<String, Object>? extra, bool push = false}) {
  Map<String, Object> finalExtra = extra ?? <String, Object>{};

  if (labels != null) {
    if (finalExtra.containsKey('labels')) {
      throw Exception("The 'labels' key in extra is reserved for tGo().");
    }

    finalExtra['labels'] = labels;
  }

  push ? this.push(location, extra: finalExtra) : go(location, extra: finalExtra);
}