How are child routes definded in Angular 2.0 for Dart


In typescript a child route can be defined like so:

export const routes: Routes = [
  { path: '', redirectTo: 'product-list', pathMatch: 'full' },
  { path: 'product-list', component: ProductList },
  { path: 'product-details/:id', component: ProductDetails,
    children: [
      { path: '', component: Overview },
      { path: 'specs', component: Specs }

In dart the @RouteConfig meta is similar, but there is not a childen property on a Route to define child routes.

What is the proper way to define child routes in Dart? Angular 2.0 for dart was released, but the documentation is still completely lacking when it comes to using routes in dart.


Yes, documentation is lacking, I apologize. We have a new sub-team working on fixing this, definitely is going to get much better. For the time being, I can help a bit – your ProductDetails component simply needs to declare it’s own @RouteConfig:

@RouteConfig(const [
  const Route(path: '', component: Overview),
class ProductDetails {}

Answered By – matanlurey

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *