Home > Enterprise >  In Flutter, how to share the text using share_plus in a the format that I want
In Flutter, how to share the text using share_plus in a the format that I want

Time:07-29

I'm currently building a password manager using Flutter. I have used share_plus.dart package , to share the passwords stored by the user. I have 4 text fields in my password, they are : title, email, password(userpassword), and url.

When I share them, they get displayed in a not good looking format. So,I want to display, the text shared using the share button on my flutter app in a particular format.

The format, I want:

Title: value
Email: value
Password: value
url: value

My code:

          IconButton(
            onPressed: () async {
              final text = _titleController.text   _emailController.text   _userPasswordController.text   _urlController.text;
              if (_password == null || text.isEmpty) {
                await showCannotShareEmptyPasswordDialog(context);
              } else {
                Share.share(text);
              }
            },
            icon: const Icon(Icons.share),
          ),

CodePudding user response:

Share.share("Title: $Title"\n Email: $value" \n);

Try using this, this might help you

in my case i did like this

ShareClass.shareMethod(
        message:
        "Join me on App! It is an awesome and secure app we can use to connect with each other Download it at: ${Platform.isAndroid ? "https://play.google.com/store/apps/details?id" : "https://apps.apple.com/us/app/app"}");
  }
  • Related