Orientação gerada a partir de informações públicas. Apenas para referência.
O pacote intent é um plugin simples do Flutter projetado para simplificar o manuseio de Intents no Android. Permite uma comunicação fluida entre aplicativos Flutter e componentes nativos do Android, permitindo que desenvolvedores iniciem atividades, enviem transmissões e gerenciem intents com código mínimo. Ideal para compartilhar dados, abrir aplicativos externos ou acionar ações do sistema, como enviar e-mails ou mensagens. O plugin abstrai a complexa API de Intent do Android em métodos Dart fáceis de usar, tornando-o acessível mesmo para iniciantes. Com documentação clara e manutenção ativa, serve como uma ponte confiável entre o Flutter e a funcionalidade nativa do Android.
Casos de uso
Compartilhando conteúdo entre aplicativos
Iniciando aplicativos externos
Enviando intenções de difusão
Abrir configurações do sistema
Manipulação de links profundos
Disparar ações do dispositivo
Principais recursos
Interface simples do Dart para Android Intents
Suporta intenções implícitas e explícitas
Integração fácil com fluxos de trabalho do Flutter
Código mínimo de boilerplate
Repositório ativo no GitHub
Documentação clara
Indicado para
Desenvolvedores Flutter direcionados ao Android
Aplicativos que precisam de ações específicas do Android
Recursos de compartilhamento e link profundo
Iniciantes aprendendo integração com Android
Considerações
Funcionalidade exclusiva para Android
Limitado à plataforma Android
Requer conhecimento do Android SDK para uso avançado
Sem suporte para iOS
Pode ser necessário permissões adicionais para certos intents
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Warning I've stopped maintaining this project !
intent
A simple flutter plugin to deal with Android Intents - your one stop solution for Android Intents, written with :heart:.
Show some :heart: by putting :star:
intent tries to help you in launching another android activity using Android Intents. This Dart API replicates Android Intent API, so for detailed information on how to use it efficiently, when to send what kind of data, you may be interested in taking a look here, which explains things more elaborately.
intent is your one stop solution for handling different Android Intents from Flutter app.
It provides an easy to use Dart API, which can be used to launch different kind of Android Activities
You can view / create documents
Pick document(s) from Document Tree
Open default Assist Activity
Perform a Web Search
Request definition of a certain string to default Assist Activity
Open image for editing / viewing
Share text / multimedia to another activity
Send Email to specific user, while also setting CC & BCC
Share multiple documents at a time
Sync system content
Translate text
Set Wallpaper
Open any URL
Open Dialer for calling a specific number
Can pick a contact from your default phone activity
Can capture a photo using default Camera Activity
latest addition
Newest Addition: You can pass extra data's type information, while invoking Intent.putExtra(String extra, dynamic data, {String type}) as optional named param type. You don't even need to hardcode type names as Strings, rather a class named TypedExtra has been given to developers, which has all currently supported type names as static variables. Consider using them. And last but not least, this is not a breaking change !!!
But if you're interested in creating a chooser i.e. all eligible candidates shown up system, which can handle this intent, make sure you set createChooser named parameter to true, which is by default false.
Send Email to certain ID while setting Content and CC/ BCC :
Path to captured image can be grabbed from Intent().startActivityForResult().then(() { ... } ), which will be provided in form of List<String>, open file using that path, File(data[0]). Now you can work on that image file.
Intent()
..setAction(Action.ACTION_IMAGE_CAPTURE)
..startActivityForResult().then((data) => print(data[0]), // gets you path to image captured
onError: (e) => print(e));
If you're not interested in showing default activity launch animation, set following flag.
If you request for certain Activity and no eligible candidate was found, you'll receive one error message, which you can listen for using Future.catchError((e) {},) method.
PlatformException(Error, android.content.ActivityNotFoundException: NoActivity found to handle Intent { act=android.intent.action.SYSTEM_TUTORIAL }, null)
Currently a limited number of Actions are provided in Action class, but you can always use a string constant as an Action, which will help you in dealing with many more Activities.