Short snippets of code to help you become productive with Dart.
See the source on Github.
- Setting up a controller
- Using multiple controllers
- Conditionally displaying content
- Conditionally switching between DOM element
- Displaying items in a list
- Setting element classes using a string
- Setting element classes using a list
- Setting element classes using a map
- Creating a simple component
- Applying outside styles to a component
- Adding an element into the Shadow DOM
- Binding an attribute to a string
- Creating a one-way binding
- Creating a one-way one-time binding
- Creating a two-way binding
- Creating a component that allows child tags
- Creating a component that allows only select child tags
- Creating a component that can be used as table row <tr>
- A list component that creates its items dynamically from data
- A component that repeats over its child nodes
- Binding to a boolean using a checkbox
- Selecting an item from a dropdown
- Binding to text fields
- Selecting a radio button
- Selecting multiple checkboxes
- Setting up simple routing
- Nesting routes
- Accessing the router in the controller
- Accessing route params within components
- Setting up a default view
- Redirecting to a new route
- Shortening a list
- Shortening a string
- Filtering list contents based on a string match
- Ordering list contents
- Filtering list contents using a function
- Ordering list contents by field
- Ordering list contents in reverse order
- Deleting a file, directory, or symlink
- Renaming a file, directory, or symlink
- Finding the type of a filesystem object
- Getting the parent directory
- Creating a file
- Reading a file as a string
- Reading a file as lines
- Reading a file as bytes
- Using a stream to read a file
- Handling errors when reading a file
- Writing a string to a file
- Writing bytes to a file
- Using a stream to write to a file
- Creating a directory
- Creating a temp directory
- Listing the contents of a directory
- Creating a symlink
- Checking if a path represents a symlink
- Getting the target of a symlink
- Making a GET request
- Making a POST request
- Adding custom headers to a request
- Making multiple requests to the same server
- Handling errors when making a request
- Getting redirection history
- Getting the response body as a string
- Getting the response content in binary format
- Getting the response headers
- Implementing a dead-simple HTTP server
- Listing directory contents
- Serving index.html
- Serving a 404
- Routing requests based on URL patterns
- Getting environment variables
- Identifying the operating system
- Getting information about the script being run