Skip to content
forked from TimmyRB/snapkit

SnapKit is a Flutter plugin that allows you to integrate Snapchat's own SDKs into your Flutter projects!

License

Notifications You must be signed in to change notification settings

JonasWanke/snapkit

 
 

Repository files navigation

Snapkit

Pub Package Code Analysis Android Builds iOS Builds

A plugin that allows developers like you to integrate with Snapchat (using SnapKit) into your Flutter applications!

Getting Started

Follow the Wiki for steps on how to get setup in an existing project or just copy the example project into a directory of your choosing and rename it.

Usage

Create new Instance

final snapkit = Snapkit();

AuthState Stream

snapkit.onAuthStateChanged.listen((SnapchatUser? user) {
    // Do something with the returned SnapchatUser or null here
});

AuthState Class

class MyAppState extends State<MyApp> implements SnapchatAuthStateListener {
  @override
  void initState() {
    super.initState();
    _snapkit.addAuthStateListener(this);
  }

  @override
  void onLogin(SnapchatUser user) {
    // Do something with the returned SnapchatUser here
  }

  @override
  void onLogout() {
    // Do something on logout
  }
}

Login

await snapkit.login();

Logout

await snapkit.logout();

Verify a Phone Number

Returns a bool if Snapchat has verified the phone number, throws an error if there was a problem. Always returns false on Android.

try {
  final isVerified = await snapkit.verifyPhoneNumber('US', '1231234567');
} catch (error, stackTrace) {
  // Handle error
}

Share to Snapchat

Share to LIVE

snapkit.share(
  SnapchatMediaType.NONE,
  sticker: SnapchatSticker?,
  caption: String?,
  attachmentUrl: String?
);

Share with Background Photo

snapkit.share(
  SnapchatMediaType.PHOTO,
  image: ImageProvider,
  sticker: SnapchatSticker?,
  caption: String?,
  attachmentUrl: String?,
);

Share with Background Video

Currently unavailable on Android.

snapkit.share(
  SnapchatMediaType.VIDEO,
  videoUrl: String,
  sticker: SnapchatSticker?,
  caption: String?,
  attachmentUrl: String?,
);

SnapchatSticker

SnapchatSticker(
  image: ImageProvider,
);

About

SnapKit is a Flutter plugin that allows you to integrate Snapchat's own SDKs into your Flutter projects!

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 47.2%
  • Java 30.3%
  • Swift 15.9%
  • Ruby 5.0%
  • Objective-C 1.3%
  • Kotlin 0.3%