Created
December 30, 2016 19:21
-
-
Save rinukkusu/d3ff92d1e58010a5b95805a0dee1742f to your computer and use it in GitHub Desktop.
Dart Routing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 { | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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