What is an Intent?
An Intent is a 'passive' data structure that holds an abstract description of an action to be performed. It acts as the glue between different components—even those in different applications. For your Revochamp project, Intents are the mechanism used to transition from your Flutter UI to a native Android 'Preview' or to share a generated code snippet to an external editor.
- Explicit Intents
Explicit intents specify exactly which component (class name) should be started. You use these for internal navigation within your native Android Runner code where you know the exact target class.
- Implicit Intents
Implicit intents do not name a specific component. Instead, they declare a general action to be performed (e.g., 'view a map' or 'send an email'). The Android system then finds all apps that can handle that action using Intent Filters and lets the user choose. This is vital for Revochamp's 'Export' and 'Share' features.
- Intent Filters: Receiving Requests
If you want the Revochamp app to open when a user clicks a specific link (Deep Linking), you must declare an Intent Filter in your AndroidManifest.xml. This tells the OS, 'My app is capable of handling this specific type of data or action.'
Intent Type Comparison
| Feature | Explicit Intent | Implicit Intent |
|---|---|---|
| Target | Specific Class (Internal) | Action Type (System-wide) |
| Use Case | Moving between your own screens | Integrating with other apps |
| Security | High (Targets your own code) | Lower (Needs 'exported' flag) |
| Flexibility | Low (Fixed path) | High (User chooses the app) |
| Deep Linking | N/A | Primary mechanism |