सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक फ्लटर प्लगइन जो फ्लटर एप्लिकेशन में लाइन एसडीके के एंटीग्रेशन की अनुमति देता है, जिससे डेवलपर्स लाइन के प्रमाणीकरण, संदेश और साझाकरण विशेषताओं का उपयोग कर सकते हैं। यह एंड्रॉइड और आईओएस प्लेटफॉर्म दोनों का समर्थन करता है, एप्लिकेशन में लाइन लॉगिन, रिच मैसेज और इंटरैक्टिव कंटेंट जोड़ने का बेहतर तरीका प्रदान करता है। प्लगइन लाइन डेवलपर्स द्वारा बनाए गए हैं और pub.dev के माध्यम से आसान सेटअप के लिए डिज़ाइन किया गया है। यह फ्लटर के क्रॉस-प्लेटफॉर्म क्षमताओं के साथ संगतता बनाए रखते हुए लाइन के इकोसिस्टम के माध्यम से उपयोगकर्ता भागीदारी को बढ़ावा देता है।
उपयोग
LINE लॉगिन प्रमाणीकरण का कार्यान्वयन करें
LINE के माध्यम से ऐप-आंतरिक संदेश प्रणाली सक्षम करें
LINE के माध्यम से सामग्री साझा करना
LINE Pay कार्यक्षमता को एकीकृत करना
चैट-आधारित उपयोगकर्ता अनुभव बनाना
मुख्य विशेषताएँ
Android और iOS के लिए क्रॉस-प्लेटफॉर्म समर्थन
pub.dev के माध्यम से फ्लटर के साथ आसान एकीकरण
LINE द्वारा आधिकारिक रूप से बनाए गए
LINE लॉगिन और संदेश साझाकरण का समर्थन करता है
प्लेटफॉर्म के बीच सुसंगत API प्रदान करता है
इनके लिए उपयुक्त
LINE प्रमाणीकरण की आवश्यकता वाले ऐप्स
सामाजिक या समुदाय-चालित एप्लिकेशन
LINE Pay का उपयोग करने वाले ई-कॉमर्स ऐप्स
LINE पारिस्थितिकी तंत्र पर निर्माण कर रहे विकासकर्ता
जापानी या एशियाई बाजार के लक्ष्य वाले Flutter परियोजनाएं
विचार योग्य बातें
LINE डेवलपर कंसोल में कॉन्फ़िगरेशन की आवश्यकता होती है
LINE-विशिष्ट विशेषताओं तक सीमित
पूर्ण कार्यक्षमता के लिए अतिरिक्त अनुमतियों की आवश्यकता हो सकती है
कुछ सुविधाओं के लिए डिवाइस पर LINE ऐप स्थापित होना आवश्यक है
गैर-LINE संबंधित उपयोग के लिए उपयुक्त नहीं
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
flutter_line_sdk
A Flutter plugin that lets developers access LINE's native SDKs in Flutter apps with Dart.
The plugin helps you integrate LINE Login features in your app. You can redirect users to LINE or a web page where they log in with their LINE credentials. Example:
import'package:flutter_line_sdk/flutter_line_sdk.dart';
voidlogin() async {
try {
final result = awaitLineSDK.instance.login();
setState(() {
_userProfile = result.userProfile;
// user id -> result.userProfile?.userId// user name -> result.userProfile?.displayName// user avatar -> result.userProfile?.pictureUrl// etc...
});
} onPlatformExceptioncatch (e) {
// Error handling.print(e);
}
}
From version 2.0, flutter_line_sdk supports null safety. If you are still seeking a legacy version without null safety, check version 1.3.0.
Flutter 3.44.0 or later. Version 3.0 relies on Flutter's built-in Kotlin support for Android builds; if your project is still on an older Flutter version, use flutter_line_sdk 2.x instead.
iOS 15.0 or later as the deployment target
Android minSdkVersion set to 24 or higher (Android 7.0 or later)
To access your LINE Login channel from a mobile platform, you need some extra configuration. In the LINE Developers console, go to your LINE Login channel settings, and enter the below information on the App settings tab.
iOS app settings
Setting
Description
iOS bundle ID
Required. Bundle identifier of your app. In Xcode, find it in your Runner project settings, on the General tab. Must be lowercase, like com.example.app. You can specify multiple bundle identifiers by typing each one on a new line.
iOS universal link
Optional. Set to the universal link configured for your app. For more information on how to handle the login process using a universal link, see Universal Links support.
Android app settings
Setting
Description
Android package name
Required. Application's package name used to launch the Google Play store.
Android package signature
Optional. You can set multiple signatures by typing each one on a new line.
Android scheme
Optional. Custom URL scheme used to launch your app.
Installation
Adding flutter_line_sdk package
Use the standard way of adding this package to your Flutter app, as described in the Flutter documentation:
flutter pub add flutter_line_sdk
Now, the Dart part of flutter_line_sdk should be installed. Next, you need to set up LINE SDK for iOS and Android projects, respectively.
Set up LINE SDK
iOS
Open the file ios/Runner/Info.plist in a text editor and insert this snippet just before the last </dict> tag:
<key>CFBundleURLTypes</key><array><dict><key>CFBundleTypeRole</key><string>Editor</string><key>CFBundleURLSchemes</key><array><!-- Specify URL scheme to use when returning from LINE to your app. --><string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string></array></dict></array><key>LSApplicationQueriesSchemes</key><array><!-- Specify URL scheme to use when launching LINE from your app. --><string>lineauth2</string></array>
Because LINE SDK now requires iOS 15.0 or above to provide underlying native features, while the default deployment
target of Flutter is 13.0, you must set the deployment target to 15.0 or higher.
Swift Package Manager integration (default)
Following Flutter's official direction, Swift Package Manager is the default way of managing iOS native dependencies since Flutter 3.44, and it is the integration path this plugin primarily targets. The bundled example app uses Swift Package Manager exclusively and cannot be built with Swift Package Manager opted out.
CocoaPods integration keeps working and remains supported, but it is in maintenance mode, in line with Flutter's own plan for CocoaPods. If your project has opted out of Swift Package Manager, add this line in the Runner target in ios/Podfile:
target 'Runner' do
+ platform :ios, '15.0'
use_frameworks!
use_modular_headers!
...
Android
To ensure compatibility with the latest features, you need to update the minSdk version in your app's build.gradle file to 24 or higher.
Here's how you can do it:
Open your app's build.gradle file.
Locate the android block, and within it, find the defaultConfig block.
In the defaultConfig block, replace the current minSdk value with 24.
Here's a diff to show what your changes might look like:
This is merely an example. You can call setup any time you want, provided you call it exactly once, before calling any other LINE SDK methods.
To help you get started with this package, we list several basic usage examples below. All available flutter_line_sdk methods are documented on the Dart Packages site.
Login
Now you are ready to let your user log in with LINE.
Get the login result by assigning the value of Future<LoginResult> to a variable.
To handle errors gracefully, wrap the invocation in a try...on statement:
void_signIn() async {
try {
final result = awaitLineSDK.instance.login();
// user id -> result.userProfile?.userId// user name -> result.userProfile?.displayName// user avatar -> result.userProfile?.pictureUrl
} onPlatformExceptioncatch (e) {
_showDialog(context, e.toString());
}
}
By default, login uses ["profile"] as its scope. In this case, when login is done, you have a userProfile value in login result.
If you need other scopes, pass them in a list to login. See the Scopes documentation for more.
final result = awaitLineSDK.instance.login(
scopes: ["profile", "openid", "email"]
);
// user email, if user set it in LINE and granted your request.final userEmail = result.accessToken.email;
Although it might be useless, if you do not contain a "profile" scope, userProfile will be a null value.
try {
final result = awaitLineSDK.instance.getProfile();
// user id -> result.userId// user name -> result.displayName// user avatar -> result.pictureUrl
} onPlatformExceptioncatch (e) {
print(e.message);
}
Get current stored access token
try {
final result = awaitLineSDK.instance.currentAccessToken;
// access token -> result?.value
} onPlatformExceptioncatch (e) {
print(e.message);
}
If the user isn't logged in, it returns a null. A valid result of this method doesn't necessarily mean the access
token itself is valid. It may have expired or been revoked by the user from another device or LINE client.
Verify access token with LINE server
try {
final result = awaitLineSDK.instance.verifyAccessToken();
// result.data is accessible if the token is valid.
} onPlatformExceptioncatch (e) {
print(e.message);
// token is not valid, or any other error.
}
Normally, you don't need to refresh access tokens manually, because any API call in LINE SDK will try to refresh the access token automatically when necessary.
We do not recommend refreshing access tokens yourself.
It's generally easier, more secure, and more future-proof to let the LINE SDK manage access tokens automatically.
Error handling
All APIs can throw a PlatformException with error code and a message. Use this information to identify when an error happens inside the native SDK.
Error codes and messages will vary between iOS and Android. Be sure to read the error definition on iOS and Android to provide better error recovery and user experience on different platforms.
Contributing
If you believe you found a vulnerability or you have an issue related to security, please DO NOT open a public issue. Instead, send us an email at [dl_oss_dev@linecorp.com](mailto:dl_oss_dev@linecorp.com).
Before contributing to this project, please read CONTRIBUTING.md.