Skip to content

Instantly share code, notes, and snippets.

@rinukkusu
Created December 30, 2016 19:21
Show Gist options
  • Save rinukkusu/d3ff92d1e58010a5b95805a0dee1742f to your computer and use it in GitHub Desktop.
Save rinukkusu/d3ff92d1e58010a5b95805a0dee1742f to your computer and use it in GitHub Desktop.
Dart Routing
@Component(...)
@RouteConfig(const [
const Route( path: '/', name: 'Home', component: HomeView ),
const Route( path: '/search', name: 'Search', component: SearchView ),
const Route( path: '/error', name: 'Error', component: ErrorView ),
const Route( path: '/shop/...', name: 'Shop', component: ShopView ),
const Route( path: '/:slug', name: 'Page', component: PageView ),
])
class AppComponent {
// ...
}
@Component(...)
@RouteConfig(const [
const Route( path: '/', name: 'ShopHome', component: ShopHomeView, useAsDefault: true ),
const Route( path: '/checkout', name: 'Checkout', component: CheckoutView ),
const Route( path: '/category/:slug', name: 'Category', component: CategoryView ),
const Route( path: '/product/:slug', name: 'Product', component: ProductDetailView ),
const Route( path: '/order/:orderkey', name: 'Order', component: OrderView ),
])
class ShopView {
ShopView(Router router) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment