### Share File to Telegram
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Provides examples for sharing various file types (videos, images) to Telegram. It uses OpenSocialShare.T.shareFileToTelegram and requires file path, type, and optionally a custom file provider path and message.
```dart
ElevatedButton(
onPressed: () async {
var video = await _picker.pickVideo(source: ImageSource.gallery);
OpenSocialShare.T.shareFileToTelegram(
filePath: video?.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.any,
message: 'Hello world',
);
},
child: const Text('Share file to Telegram'),
),
ElevatedButton(
onPressed: () async {
var image = await _picker.pickImage(source: ImageSource.gallery);
OpenSocialShare.T.shareFileToTelegram(
filePath: image?.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.any,
message: 'Hello world',
);
},
child: const Text('Share file to Telegram'),
),
```
--------------------------------
### Open Telegram Channel via Invite Link
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Opens a specific Telegram channel or group using its invite link. Requires the Telegram app to be installed. No specific input/output beyond opening the app to the specified channel.
```dart
import 'package:open_social_share/open_social_share.dart';
try {
await OpenSocialShare.T.openTelegramChannelViaShareLink(
inviteLink: 'https://t.me/joinchat/AbCdEfGhIjK',
);
} catch (e) {
print('Error opening Telegram channel: $e');
}
```
--------------------------------
### Share File to WhatsApp
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Shares various file types (image, video, PDF, vCard) to WhatsApp with an optional message. Utilizes file_picker for file selection. Requires WhatsApp to be installed.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:file_picker/file_picker.dart';
FilePickerResult? file = await FilePicker.platform.pickFiles(
type: FileType.any,
);
if (file != null && file.paths.isNotEmpty) {
try {
await OpenSocialShare.W.shareFileToWhatsApp(
filePath: file.paths[0],
fileType: AssetType.pdf,
fileProviderPath: 'com.example.app.fileprovider',
message: 'Please review this document',
dstPath: 'whatsapp_cache',
);
} catch (e) {
print('Error sharing to WhatsApp: $e');
}
}
```
--------------------------------
### Android Facebook SDK Manifest Configuration
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This set of XML tags configures the Facebook SDK within your `AndroidManifest.xml`. It includes declarations for a `FacebookContentProvider`, metadata for the Application ID and Client Token, and activity definitions for Facebook login and custom tab integration. Remember to adjust the `android:authorities` and `android:theme` according to your project's setup.
```xml
```
--------------------------------
### Send Message to WhatsApp
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Sends a text message to a specific WhatsApp contact or opens the chat selector. Requires the phone number and message content. WhatsApp must be installed.
```dart
import 'package:open_social_share/open_social_share.dart';
try {
await OpenSocialShare.W.sendMessageToWhatsApp(
message: 'Hello from my Flutter app!',
phoneNumber: '+1234567890',
);
} catch (e) {
print('Error sending WhatsApp message: $e');
}
```
--------------------------------
### Open TikTok User Page
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Opens a specific user's profile page on TikTok. Requires the username of the target account. TikTok app must be installed.
```dart
import 'package:open_social_share/open_social_share.dart';
try {
await OpenSocialShare.TI.openTikTokUserPage(
username: 'flutter_official',
);
} catch (e) {
print('Error opening TikTok profile: $e');
}
```
--------------------------------
### AppDelegate.swift Initialization for Social SDKs
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This Swift code demonstrates how to update your AppDelegate.swift file to integrate Facebook and TikTok SDKs. It shows the necessary imports and the methods to override for initializing the SDKs during application launch and handling URL callbacks.
```swift
import UIKit
import Flutter
// Add these lines
import FBSDKCoreKit
import TikTokOpenSDK
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// Add these lines
FBSDKCoreKit.ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
TikTokOpenSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
// Add this method
override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
guard let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
let annotation = options[UIApplication.OpenURLOptionsKey.annotation] else {
return false
}
if TikTokOpenSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: sourceApplication, annotation: annotation) {
return true
}
return false
}
// Add this method
override func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if TikTokOpenSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation) {
return true
}
return false
}
// Add this method
override func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
if TikTokOpenSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: nil, annotation: "") {
return true
}
return false
}
}
```
--------------------------------
### Android Manifest Query and Permission Declarations
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This section details the necessary `` and `` tags to be added to your `AndroidManifest.xml`. These are crucial for the application to interact with specific social media apps and access storage.
```xml
```
--------------------------------
### Share Multiple Media Files to Facebook
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Allows sharing a mix of image and video files to Facebook in a single post. Requires specifying file paths, provider authority, and optional metadata.
```APIDOC
## POST /facebook/feed/media
### Description
Share a combination of images and videos to Facebook in a single post.
### Method
POST
### Endpoint
/facebook/feed/media
### Parameters
#### Query Parameters
- **imageUrls** (List) - Optional - List of local paths to image files.
- **videoUrls** (List) - Optional - List of local paths to video files.
- **fileProviderPath** (String) - Required - Android file provider authority.
- **dstPath** (String) - Optional - A custom cache folder path.
- **hashtag** (String) - Optional - Hashtags to include in the post.
- **contentUrl** (String) - Optional - A URL to be shared alongside the media.
### Request Example
```json
{
"imageUrls": ["/path/to/image1.jpg", "/path/to/image2.png"],
"videoUrls": ["/path/to/video1.mp4"],
"fileProviderPath": "com.example.app.fileprovider",
"dstPath": "media_cache",
"hashtag": "#flutter",
"contentUrl": "https://flutter.dev"
}
```
### Response
#### Success Response (200)
- **status** (String) - Indicates success.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Share Media Content File to Facebook using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet allows sharing multiple images and videos to Facebook. It requires lists of image URLs and video paths, along with a file provider path. Image and file pickers are necessary dependencies.
```dart
ElevatedButton(
onPressed: () async {
imageUrls = (await _picker.pickMultiImage())?.map((image) => image.path).toList();
videoUrls = (await _pickFile(FileType.video, allowMultiple: true))?.paths;
OpenSocialShare.F.shareMediaContentFileToFacebook(
imageUrls: imageUrls,
videoUrls: videoUrls,
fileProviderPath: 'your_custom_fileProvider_path',
);
},
child: const Text('Share media content file to facebook'),
),
```
--------------------------------
### Info.plist Configuration for iOS Social Sharing
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This XML snippet shows the required keys and values to add to your project's Info.plist file for enabling Facebook and TikTok sharing. It includes URL schemes for various social platforms, necessary privacy descriptions for accessing device resources, and app-specific identifiers for Facebook and TikTok.
```xml
CFBundleURLTypes
CFBundleURLSchemes
fb[your_facebook_app_id]
[your_tiktok_app_id]
LSApplicationQueriesSchemes
instagram
fb
fbauth2
fbshareextension
fbapi
facebook-reels
facebook-stories
fb-messenger-share-api
fb-messenger
tg
whatsapp
twitter
tiktokopensdk
tiktoksharesdk
snssdk1180
snssdk1233
NSPhotoLibraryUsageDescription
$(PRODUCT_NAME) needs permission to access photos and videos on your device
NSMicrophoneUsageDescription
$(PRODUCT_NAME) does not require access to the microphone.
NSCameraUsageDescription
$(PRODUCT_NAME) requires access to the camera.
NSAppleMusicUsageDescription
$(PRODUCT_NAME) requires access to play music
FacebookAppID
[your_facebook_app_id]
FacebookClientToken
[your_facebook_client_token]
FacebookDisplayName
[your_facebook_app_display_name]
NSBonjourServices
_dartobservatory._tcp
TikTokAppID
[your_tiktok_app_id]
```
--------------------------------
### Share Link Content to Facebook using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet demonstrates sharing a simple link to Facebook. It requires the content URL as input and uses the OpenSocialShare package.
```dart
ElevatedButton(
onPressed: () {
OpenSocialShare.F.shareLinkContentToFacebook(
contentUrl: "https://pub.dev",
);
},
child: const Text('Share link content to facebook'),
),
```
--------------------------------
### Android FileProvider Paths Configuration
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This XML defines the file paths that will be shared using the FileProvider. It should be placed in a new XML file within the `android/app/src/main/res/xml` directory. This configuration is essential for securely sharing files with other applications.
```xml
```
--------------------------------
### Create Twitter Tweet
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Illustrates creating a tweet on Twitter with text, a URL, hashtags, and author information. This function, `createTwitterTweet`, allows for detailed tweet composition using OpenSocialShare.TW.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.TW.createTwitterTweet(
title: 'Hello world',
attachedUrl: "https://pub.dev",
hashtags: [
'hello',
'world',
],
via: 'abc',
related: ['twitter', 'twitterapi'],
);
},
child: const Text('Create Twitter tweet'),
),
```
--------------------------------
### Share File to WhatsApp
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Demonstrates sharing files, such as PDFs, to WhatsApp using OpenSocialShare.W.shareFileToWhatsApp. It requires the file path, file type, and can include a custom file provider path and message.
```dart
ElevatedButton(
onPressed: () async {
var file = await _pickFile(FileType.any);
OpenSocialShare.W.shareFileToWhatsApp(
filePath: file?.paths[0],
fileType: AssetType.pdf,
fileProviderPath: 'your_custom_fileProvider_path',
message: 'Hello world',
);
},
child: const Text('Share file to WhatsApp'),
),
```
--------------------------------
### Share File to Twitter
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Shares an image or video file to Twitter with an optional caption. Requires Twitter app and user credentials (consumer keys). Uses image_picker for file selection.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var image = await _picker.pickImage(source: ImageSource.gallery);
if (image != null) {
try {
await OpenSocialShare.TW.shareFileToTwitter(
filePath: image.path,
fileProviderPath: 'com.example.app.fileprovider',
fileType: AssetType.image,
iOSConsumerKey: 'your_twitter_consumer_key',
iOSSecretKey: 'your_twitter_secret_key',
title: 'Check out this image!',
dstPath: 'twitter_cache',
);
} catch (e) {
print('Error sharing to Twitter: $e');
}
}
```
--------------------------------
### Share Files to TikTok
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shows how to share multiple image files to TikTok using OpenSocialShare.TI.shareFilesToTikTok. It requires a list of file URLs, the file type, and a custom file provider path.
```dart
ElevatedButton(
onPressed: () async {
var res = await _picker.pickMultiImage();
OpenSocialShare.TI.shareFilesToTikTok(
fileUrls: res?.map((e) => e.path).toList(),
fileType: AssetType.image,
fileProviderPath: 'your_custom_fileProvider_path',
);
},
child: const Text('Share files to TikTok'),
),
```
--------------------------------
### Share File to Facebook using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet demonstrates how to share a file (image or video) to Facebook. It requires the file path, an optional destination path, a file provider path, and the asset type. Dependencies include the image picker and OpenSocialShare.
```dart
ElevatedButton(
onPressed: () async {
var video =
await _picker.pickImage(source: ImageSource.gallery);
if (video != null) {
OpenSocialShare.F.shareFileToFacebook(
filePath: video.path,
dstPath: 'your_custom_save_folder',
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.image,
);
}
},
child: const Text('Share file to facebook'),
),
```
--------------------------------
### Share Camera Effect to Facebook using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet enables sharing camera effects to Facebook, including texture information and arguments. It requires a texture key, URL, argument key, value, and list, along with an optional hashtag and content URL. Dependencies include image picker and OpenSocialShare.
```dart
ElevatedButton(
onPressed: () async {
var texture =
await _picker.pickImage(source: ImageSource.gallery);
if (texture != null) {
OpenSocialShare.F.shareCameraEffectToFacebook(
cameraEffectTextures: CameraEffectTextures(
textureKey: 'texture_key',
textureUrl: texture.path,
),
cameraEffectArguments: const CameraEffectArguments(
argumentKey: 'argument_key',
argumentValue: 'argument_value',
argumentList: ['argument_value'],
),
hashtag: '#helloworld',
contentUrl: 'https://pub.dev',
);
}
},
child: const Text('Share camera effect to facebook'),
)
```
--------------------------------
### Android Facebook App ID and Client Token Strings
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This XML file, `strings.xml`, should be created in `/android/app/src/main/values`. It holds your Facebook App ID and Client Token, which are necessary for Facebook integration. Ensure you replace the bracketed placeholders with your actual credentials obtained from Meta for developers.
```xml
[facebook_app_id]
[facebook_client_token]
```
--------------------------------
### Share File to Twitter
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Demonstrates sharing an image file to Twitter using OpenSocialShare.TW.shareFileToTwitter. It requires the file path, type, iOS API keys, and optionally a title.
```dart
ElevatedButton(
onPressed: () async {
var file = await _picker.pickImage(source: ImageSource.gallery);
OpenSocialShare.TW.shareFileToTwitter(
filePath: file?.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.image,
iOSConsumerKey: 'abc',
iOSSecretKey: 'xyz',
title: "Hello world",
);
},
child: const Text('Share file to Twitter'),
),
```
--------------------------------
### Open Telegram Channel via Share Link
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Illustrates opening a Telegram group or channel using its invite link. This functionality is accessed via OpenSocialShare.T.openTelegramChannelViaShareLink and requires a valid invite link.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.T.openTelegramChannelViaShareLink(
inviteLink: 'your_invite_link',
);
},
child: const Text('Open Telegram group via invite link'),
),
```
--------------------------------
### Android FileProvider Manifest Declaration
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shows how to declare the `FileProvider` in your `AndroidManifest.xml`. It includes the `android:authorities` attribute, which must be unique and include your application ID and custom file provider path, and links to your custom paths XML file.
```xml
```
--------------------------------
### Share Files to TikTok
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Shares multiple images or videos to TikTok, supporting green screen format and directing users to an editable page. Requires TikTok app and specifies file types and hashtags.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var images = await _picker.pickMultiImage();
if (images != null && images.isNotEmpty) {
try {
await OpenSocialShare.TI.shareFilesToTikTok(
fileUrls: images.map((e) => e.path).toList(),
fileType: AssetType.image,
fileProviderPath: 'com.example.app.fileprovider',
dstPath: 'tiktok_cache',
shareFormat: TikTokShareFormatType.greenScreen,
landedPageType: TikTokLandedPageType.edit,
hashtag: ['flutter', 'app', 'mobile'],
);
} catch (e) {
print('Error sharing to TikTok: $e');
}
}
```
--------------------------------
### Share Sticker Asset to Facebook Story
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Allows sharing a sticker image as an overlay on a Facebook Story, with options to specify background colors for the sticker.
```APIDOC
## POST /facebook/story/sticker
### Description
Share a sticker overlay to Facebook Story with custom background colors.
### Method
POST
### Endpoint
/facebook/story/sticker
### Parameters
#### Query Parameters
- **appId** (String) - Required - Your Facebook App ID.
- **stickerPath** (String) - Required - The local path to the sticker image file.
- **fileProviderPath** (String) - Required - Android file provider authority.
- **dstPath** (String) - Optional - A custom cache folder path.
- **stickerTopBgColors** (List) - Optional - List of hex color codes for the top background gradient.
- **stickerBottomBgColors** (List) - Optional - List of hex color codes for the bottom background gradient.
### Request Example
```json
{
"appId": "1234567890",
"stickerPath": "/path/to/your/sticker.png",
"fileProviderPath": "com.example.app.fileprovider",
"dstPath": "sticker_cache",
"stickerTopBgColors": ["#FF5733", "#FFC300"],
"stickerBottomBgColors": ["#C70039", "#900C3F"]
}
```
### Response
#### Success Response (200)
- **status** (String) - Indicates success.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Create Twitter Tweet
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Creates a tweet on Twitter with text, hashtags, and an optional URL. Supports 'via' and 'related' parameters for tagging other users. Requires Twitter app or web access.
```dart
import 'package:open_social_share/open_social_share.dart';
try {
await OpenSocialShare.TW.createTwitterTweet(
title: 'Just built an amazing Flutter app!',
attachedUrl: 'https://flutter.dev',
hashtags: ['flutter', 'mobiledev', 'coding'],
via: 'FlutterDev',
related: ['dart_lang', 'GoogleDevs'],
);
} catch (e) {
print('Error creating tweet: $e');
}
```
--------------------------------
### Create and Share to Twitter (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Dart functions for creating Twitter tweets and sharing files to Twitter. These functions are cross-platform and require Twitter API integration.
```dart
Future createTwitterTweet();
Future shareFileToTwitter();
```
--------------------------------
### Android Manifest Namespace and Tools
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shows how to add the `xmlns:tools` namespace to the `manifest` tag in `AndroidManifest.xml`. This is often required for other manifest attributes and tools configurations.
```xml
```
--------------------------------
### Share File to Messenger
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shares a selected video file to Messenger. It requires picking a video from the gallery and uses the file path, file provider path, file type (set to video), an optional hashtag, and a content URL.
```dart
ElevatedButton(
onPressed: () async {
var video = await _picker.pickVideo(source: ImageSource.gallery);
OpenSocialShare.M.shareFileToMessenger(
filePath: video?.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.video,
hashtag: '#helloworld',
contentUrl: 'https://pub.dev',
);
},
child: const Text('Share file to messenger'),
),
```
--------------------------------
### Share Video to Facebook Reels
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shares a video asset, optionally with a sticker, to Facebook Reels. Users can pick a video file and an image for the sticker from the gallery. Requires the video file path, a custom file provider path, the Facebook App ID, and the sticker path (if provided).
```dart
ElevatedButton(
onPressed: () async {
var sticker = await _picker.pickImage(source: ImageSource.gallery);
var video = await _pickFile(FileType.video);
OpenSocialShare.F.shareVideoToFacebookReels(
filePath: video?.paths[0],
fileProviderPath: 'your_custom_fileProvider_path',
appId: 'your_facebook_app_id',
stickerPath: sticker?.path,
);
},
child: const Text('Share video asset (and sticker on Android) to facebook reels'),
),
```
--------------------------------
### Share Content to Facebook (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Defines asynchronous functions for sharing various types of content to Facebook across different platforms. These functions do not have specific dependencies mentioned but are intended for use within a Dart environment integrated with the Facebook SDK.
```dart
Future shareFileToFacebook();
Future shareFeedContentToFacebook();
Future shareLinkContentToFacebook();
Future shareMediaContentFileToFacebook();
Future shareBackgroundAssetFileToFacebookStory();
Future shareStickerAssetToFacebookStory();
Future shareVideoToFacebookReels();
Future shareCameraEffectToFacebook();
```
--------------------------------
### Interact with Telegram (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
A set of Dart functions for interacting with Telegram, including sending messages, opening direct messages, sharing files, and opening channels via share links. These functions are cross-platform.
```dart
Future sendMessageToTelegram();
Future openTelegramDirectMessage();
Future openTelegramChannelViaShareLink();
Future shareFileToTelegram();
```
--------------------------------
### Share Background Asset File to Facebook Story using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shares a video file as a background asset to a Facebook story. It requires the Facebook App ID, file path, file provider path, and asset type. Dependencies include video picker and OpenSocialShare.
```dart
ElevatedButton(
onPressed: () async {
var image = await _picker.pickVideo(source: ImageSource.gallery);
OpenSocialShare.F.shareBackgroundAssetFileToFacebookStory(
appId: 'your_facebook_app_id',
filePath: image?.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.video,
);
},
child: const Text(
'Share background asset file to facebook story',
),
),
```
--------------------------------
### Share File to Telegram
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Shares a file (image, video, document) to Telegram with an optional message. Requires the Telegram app and uses image_picker for file selection. Outputs the file to Telegram.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var video = await _picker.pickVideo(source: ImageSource.gallery);
if (video != null) {
try {
await OpenSocialShare.T.shareFileToTelegram(
filePath: video.path,
fileProviderPath: 'com.example.app.fileprovider',
fileType: AssetType.any,
message: 'Check out this video!',
dstPath: 'telegram_cache',
);
} catch (e) {
print('Error sharing to Telegram: $e');
}
}
```
--------------------------------
### Share Sticker Asset to Facebook Story using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shares a sticker image as a background asset to a Facebook story. It requires the Facebook App ID, sticker path, and file provider path. Dependencies include image picker and OpenSocialShare.
```dart
ElevatedButton(
onPressed: () async {
var image = await _picker.pickImage(source: ImageSource.gallery);
OpenSocialShare.F.shareStickerAssetToFacebookStory(
appId: 'your_facebook_app_id',
stickerPath: image?.path,
fileProviderPath: 'your_custom_fileProvider_path',
);
},
child: const Text('Share sticker background asset to facebook story'),
),
```
--------------------------------
### Share Content to WhatsApp (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Asynchronous Dart functions for sharing files and sending messages via WhatsApp. These are intended for cross-platform use and require WhatsApp API integration.
```dart
Future shareFileToWhatsApp();
Future sendMessageToWhatsApp();
```
--------------------------------
### Share Background Image and Sticker to Facebook Story (iOS)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Allows users to share multiple background images and stickers to Facebook Stories specifically on iOS. It requires picking multiple images for the background and multiple images for stickers from the gallery, along with the Facebook App ID.
```dart
Visibility(
visible: Platform.isIOS,
child: ElevatedButton(
onPressed: () async {
var images = await _picker.pickMultiImage();
var stickers = await _picker.pickMultiImage();
OpenSocialShare.F.shareBackgroundImageAndStickerToFacebookStoryiOS(
photoBackgroundAssetPaths: images?.map((image) => image.path).toList(),
stickerAssetPaths: stickers?.map((image) => image.path).toList(),
appId: 'your_facebook_app_id',
);
},
child: const Text('Share background image and sticker asset to facebook story iOS'),
),
),
```
--------------------------------
### Interact with TikTok (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Dart functions for sharing files to TikTok and opening a TikTok user page. These functions are cross-platform and require TikTok API integration.
```dart
Future shareFilesToTikTok();
Future openTikTokUserPage();
```
--------------------------------
### Share Content to Messenger (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Dart functions for sharing files, sending messages, and sharing link content to Messenger. These are designed for cross-platform compatibility and require Messenger API integration.
```dart
Future shareFileToMessenger();
Future sendMessageToMessenger();
Future shareLinkContentToMessenger();
```
--------------------------------
### Share Camera Effect to Facebook (Dart)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Share custom camera effects to Facebook, including textures and arguments. This function requires defining `CameraEffectTextures` and `CameraEffectArguments`, along with a hashtag, content URL, and effect ID. It allows for advanced customization of camera effects shared via the app.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:open_social_share/models/models.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var texture = await _picker.pickImage(source: ImageSource.gallery);
if (texture != null) {
try {
await OpenSocialShare.F.shareCameraEffectToFacebook(
cameraEffectTextures: CameraEffectTextures(
textureKey: 'background_texture',
textureUrl: texture.path,
),
cameraEffectArguments: const CameraEffectArguments(
argumentKey: 'effect_config',
argumentValue: 'vintage_filter',
argumentList: ['sepia', 'vignette'],
),
hashtag: '#cameraeffect',
contentUrl: 'https://example.com/effect',
effectId: 'effect_12345',
);
} catch (e) {
print('Error sharing camera effect: $e');
}
}
```
--------------------------------
### Share Feed Content to Facebook using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shows how to share feed content, including a link, link name, and hashtag, to Facebook. It utilizes the OpenSocialShare package and requires the link URL as input.
```dart
ElevatedButton(
onPressed: () {
OpenSocialShare.F.shareFeedContentToFacebook(
link: "https://pub.dev",
linkName: "pub",
hashtag: "flutter_pub",
);
},
child: const Text('Share feed content to facebook'),
),
```
--------------------------------
### Share Facebook Story Assets on Android (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Provides specific Dart functions for sharing image and video assets to a Facebook Story background on Android. These functions likely require Android-specific implementations and permissions.
```dart
Future shareBitmapImageBackgroundAssetToFacebookStory();
Future shareImageBackgroundAssetContentToFacebookStory();
Future shareVideoBackgroundAssetContentToFacebookStory();
```
--------------------------------
### Share Image to Facebook Feed
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Allows sharing a single image file to the user's Facebook feed. Supports optional parameters for content URL, hashtags, people tags, and page ID.
```APIDOC
## POST /facebook/feed/image
### Description
Share a photo to the user's Facebook feed with optional metadata like hashtags and people tags.
### Method
POST
### Endpoint
/facebook/feed/image
### Parameters
#### Query Parameters
- **filePath** (String) - Required - The local path to the image file.
- **dstPath** (String) - Optional - A custom cache folder path.
- **fileProviderPath** (String) - Required - Android file provider authority.
- **fileType** (AssetType) - Required - Type of asset, should be 'image'.
- **hashtag** (String) - Optional - Hashtags to include in the post.
- **contentUrl** (String) - Optional - A URL to be shared alongside the image.
- **pageId** (String) - Optional - The ID of the Facebook page to share to.
- **peopleIds** (List) - Optional - List of user IDs to tag.
### Request Example
```json
{
"filePath": "/path/to/your/image.jpg",
"fileProviderPath": "com.example.app.fileprovider",
"fileType": "image",
"hashtag": "#flutter",
"contentUrl": "https://flutter.dev",
"pageId": "optional_page_id",
"peopleIds": ["user_id_1", "user_id_2"]
}
```
### Response
#### Success Response (200)
- **status** (String) - Indicates success.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Share Multiple Media Files to Facebook (Flutter)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Allows sharing a combination of images and videos in a single Facebook post. It requires lists of image and video file paths, along with a file provider path for Android. The function supports optional hashtags and content URLs.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
import 'package:file_picker/file_picker.dart';
final ImagePicker _picker = ImagePicker();
// Pick multiple images
var images = await _picker.pickMultiImage();
List? imageUrls = images?.map((image) => image.path).toList();
// Pick multiple videos
FilePickerResult? videos = await FilePicker.platform.pickFiles(
type: FileType.video,
allowMultiple: true,
);
List? videoUrls = videos?.paths;
if ((imageUrls != null && imageUrls.isNotEmpty) ||
(videoUrls != null && videoUrls.isNotEmpty)) {
try {
await OpenSocialShare.F.shareMediaContentFileToFacebook(
imageUrls: imageUrls,
videoUrls: videoUrls,
fileProviderPath: 'com.example.app.fileprovider',
dstPath: 'media_cache',
hashtag: '#flutter',
contentUrl: 'https://flutter.dev',
);
} catch (e) {
print('Error sharing media: $e');
}
}
```
--------------------------------
### Share Background Asset to Facebook Story
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Posts an image or video to a Facebook Story as a background asset. Requires the Facebook App ID and file path, along with file provider authority.
```APIDOC
## POST /facebook/story/background
### Description
Share an image or video as background content for a Facebook Story.
### Method
POST
### Endpoint
/facebook/story/background
### Parameters
#### Query Parameters
- **appId** (String) - Required - Your Facebook App ID.
- **filePath** (String) - Required - The local path to the image or video file.
- **fileProviderPath** (String) - Required - Android file provider authority.
- **fileType** (AssetType) - Required - Type of asset ('image' or 'video').
- **dstPath** (String) - Optional - A custom cache folder path.
### Request Example
```json
{
"appId": "1234567890",
"filePath": "/path/to/your/video.mp4",
"fileProviderPath": "com.example.app.fileprovider",
"fileType": "video",
"dstPath": "story_cache"
}
```
### Response
#### Success Response (200)
- **status** (String) - Indicates success.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Open TikTok User Page
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Illustrates opening a specific user's profile page on TikTok. This function, `openTikTokUserPage`, uses the provided username via OpenSocialShare.TI.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.TI.openTikTokUserPage(
username: 'username',
);
},
child: const Text('Open TikTok user page'),
),
```
--------------------------------
### Send Message to Telegram
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Demonstrates sending a simple text message to Telegram. This function utilizes the OpenSocialShare.T.sendMessageToTelegram method.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.T.sendMessageToTelegram(
message: 'Hello world',
);
},
child: const Text('Send message to Telegram'),
),
```
--------------------------------
### Share Video to Facebook Reels (Dart)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Share a video file to Facebook Reels. This function requires the video file path, a file provider path for the app, Facebook App ID, and optionally a sticker path and background colors for the sticker. It handles potential errors during the sharing process.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
import 'package:file_picker/file_picker.dart';
final ImagePicker _picker = ImagePicker();
var sticker = await _picker.pickImage(source: ImageSource.gallery);
FilePickerResult? video = await FilePicker.platform.pickFiles(
type: FileType.video,
);
if (video != null && video.paths.isNotEmpty) {
try {
await OpenSocialShare.F.shareVideoToFacebookReels(
filePath: video.paths[0],
fileProviderPath: 'com.example.app.fileprovider',
appId: '1234567890',
stickerPath: sticker?.path,
dstPath: 'reels_cache',
stickerTopBgColor: '#FF5733',
stickerBottomBgColor: '#C70039',
);
} catch (e) {
print('Error sharing to Facebook Reels: $e');
}
}
```
--------------------------------
### Share File to Messenger (Dart)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Share an image or video file to Facebook Messenger. This function supports sharing video files and includes parameters for file path, file provider path, file type, destination path, and optional metadata like hashtags and content URLs.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var video = await _picker.pickVideo(source: ImageSource.gallery);
if (video != null) {
try {
await OpenSocialShare.M.shareFileToMessenger(
filePath: video.path,
fileProviderPath: 'com.example.app.fileprovider',
fileType: AssetType.video,
dstPath: 'messenger_cache',
hashtag: '#video',
contentUrl: 'https://example.com',
);
} catch (e) {
print('Error sharing to Messenger: $e');
}
}
```
--------------------------------
### Send Message to WhatsApp
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shows how to send a message, potentially including a URL, to a specific phone number on WhatsApp. This uses OpenSocialShare.W.sendMessageToWhatsApp and requires the message content and receiver's phone number.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.W.sendMessageToWhatsApp(
message: 'https://pub.dev',
phoneNumber: "receiver_phone_number",
);
},
child: const Text('Send message to WhatsApp'),
),
```
--------------------------------
### Share Sticker Asset to Facebook Story (Flutter)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Facilitates sharing a sticker as an overlay on a Facebook Story, with support for custom background colors. This function requires the application ID, the path to the sticker image, and a file provider path for Android. It allows defining top and bottom background colors for the sticker.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var sticker = await _picker.pickImage(source: ImageSource.gallery);
if (sticker != null) {
try {
await OpenSocialShare.F.shareStickerAssetToFacebookStory(
appId: '1234567890',
stickerPath: sticker.path,
fileProviderPath: 'com.example.app.fileprovider',
dstPath: 'sticker_cache',
stickerTopBgColors: ['#FF5733', '#FFC300'],
stickerBottomBgColors: ['#C70039', '#900C3F'],
);
} catch (e) {
print('Error sharing sticker: $e');
}
}
```
--------------------------------
### Share File to Instagram
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shares a selected image file to Instagram. The user picks an image from the gallery, and the function handles sharing it using the provided file path, file provider path, and asset type (set to image).
```dart
ElevatedButton(
onPressed: () async {
var video = await _picker.pickImage(source: ImageSource.gallery);
if (video != null) {
OpenSocialShare.I.shareFileToInstagram(
filePath: video.path,
fileProviderPath: 'your_custom_fileProvider_path',
fileType: AssetType.image,
);
}
},
child: const Text('Share file to instagram'),
),
```
--------------------------------
### Share Image Background Asset Content to Facebook Story (Android) using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shares an image as a photo background asset to a Facebook story, specifically for Android. It requires the photo background asset path and file provider path. Dependencies include image picker and OpenSocialShare. Note: The Facebook SDK's ShareStoryContent class is currently not working, so alternative methods are recommended.
```dart
Visibility(
visible: Platform.isAndroid,
child: ElevatedButton(
onPressed: () async {
var image = await _picker.pickImage(source: ImageSource.gallery);
OpenSocialShare.F.shareImageBackgroundAssetContentToFacebookStory(
photoBackgroundAssetPath: image?.path,
fileProviderPath: 'your_custom_fileProvider_path',
);
},
child: const Text('Share photo background asset to facebook story'),
),
),
```
--------------------------------
### Share Content to Instagram (Dart)
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Asynchronous functions in Dart for sharing files and sending messages to Instagram. These functions are intended for cross-platform use and require Instagram API integration.
```dart
Future shareFileToInstagram();
Future sendMessageToInstagram();
```
--------------------------------
### Open Telegram Direct Message
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
Shows how to open a direct message conversation with a specific user on Telegram. It requires the target username and uses OpenSocialShare.T.openTelegramDirectMessage.
```dart
ElevatedButton(
onPressed: () async {
OpenSocialShare.T.openTelegramDirectMessage(
username: 'user_name',
);
},
child: const Text('Open Telegram direct message'),
),
```
--------------------------------
### Share Link Content to Messenger (Dart)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Share a URL link to Messenger using the Facebook SDK's `ShareLinkContent`. This method allows specifying the content URL, an optional quote, and hashtags for categorization. It's suitable for sharing web content.
```dart
import 'package:open_social_share/open_social_share.dart';
try {
await OpenSocialShare.M.shareLinkContentToMessenger(
contentUrl: 'https://pub.dev',
quote: 'Great Flutter packages here!',
hashtag: '#flutter #packages',
);
} catch (e) {
print('Error sharing link to Messenger: $e');
}
```
--------------------------------
### Share Bitmap Image Background Asset to Facebook Story (Android) using Open Social Share
Source: https://github.com/nazarenocavazzon/open_social_share/blob/main/README.md
This snippet shares a bitmap image as a background asset to a Facebook story, specifically for Android. It requires the image path and file provider path. Dependencies include image picker and OpenSocialShare. Note: The Facebook SDK's ShareStoryContent class is currently not working, so alternative methods are recommended.
```dart
Visibility(
visible: Platform.isAndroid,
child: ElevatedButton(
onPressed: () async {
var image = await _picker.pickImage(source: ImageSource.gallery);
OpenSocialShare.F.shareBitmapImageBackgroundAssetToFacebookStory(
imagePath: image?.path,
fileProviderPath: 'your_custom_fileProvider_path',
);
},
child: const Text('Share bitmap image background asset to facebook story'),
),
),
```
--------------------------------
### Share Background Asset to Facebook Story (Flutter)
Source: https://context7.com/nazarenocavazzon/open_social_share/llms.txt
Enables sharing an image or video as a background for a Facebook Story. This function requires the application ID, the file path of the asset, and a file provider path for Android. It also allows specifying the asset type and a destination cache path.
```dart
import 'package:open_social_share/open_social_share.dart';
import 'package:image_picker/image_picker.dart';
final ImagePicker _picker = ImagePicker();
var video = await _picker.pickVideo(source: ImageSource.gallery);
if (video != null) {
try {
await OpenSocialShare.F.shareBackgroundAssetFileToFacebookStory(
appId: '1234567890',
filePath: video.path,
fileProviderPath: 'com.example.app.fileprovider',
fileType: AssetType.video,
dstPath: 'story_cache',
);
} catch (e) {
print('Error sharing to Facebook Story: $e');
}
}
```