SNS 공유
플러터와 SNS 간 공유하는 가이드 위젯입니다.
텍스트, URL 공유
텍스트 또는 링크 입력 후 사용 중인 앱을 선택하여 공유합니다.
SnsShare().shareWithSns(
title: 'Example title',
text: textValue,
url: urlValue,
chooserTitle: 'Example chooser title',
);
로컬 파일 공유
로컬 파일 선택 후 사용 중인 앱을 선택하여 공유합니다.
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result != null) {
File file = File(result.files.single.path!);
SnsShare().shareLocalFile(
title: 'Example local file share',
path: file.toString(),
text: 'Example local file share text',
);
카카오톡 피드 공유
카카오톡 앱(설치 시) 또는 웹(미설치 시)으로 공유합니다.
SnsShare().shareWithKakaoTalk(feedTemplate: defaultFeed);
카카오스토리 사진 포스팅
카카오스토리로 사진을 포스팅 합니다.
SnsShare().shareWithKakaoStory(
byteData: await rootBundle.load('assets/jpg/photo.jpeg'),
tempFile: File(
'${(await getTemporaryDirectory()).path}/photo.jpeg'),
content: 'Posting photo from Kakao SDK Sample.',
);
페이스북 스토리 공유
로컬 사진 선택 후 페이스북 스토리로 공유합니다.
SnsShare().shareWithFacebookStory();
인스타그램 스토리 공유
로컬 사진 선택 후 인스타그램 스토리로 공유합니다.
SnsShare().shareWithInstagramStory();
트위터 공유
트위터 앱(설치 시) 또는 웹(미설치 시)으로 공유합니다.
SnsShare().shareWithTwitter(text: textValue!);
SMS 전송
텍스트 또는 링크를 문자로 전송합니다.
SnsShare().shareWithSms(text: textValue!);
클립보드 복사
텍스트 또는 링크를 복사합니다.
SnsShare().copyToClipboard(text: textValue!);
Last updated