flutter_line_liff

Last updated:

0 purchases

flutter_line_liff Image
flutter_line_liff Images
Add to Cart

Description:

flutter line liff

flutter_line_liff #

This Flutter plugin is developed for Flutter Web to provide ability to use LINE LIFF SDK.
- Only Support Web Platform
Usage #
To use this plugin, add flutter_line_liff as a dependency in your pubspec.yaml file.
Add Javascript LINE LIFF SDK #
Add Javascript dependency in index.html.
<head>
<script charset="utf-8" src="https://static.line-scdn.net/liff/edge/versions/2.20.3/sdk.js"></script>
<!-- your other html flags -->
</head>
copied to clipboard
Initialize LIFF SDK #
Initialize FlutterLineLiff in main function. Don't initial in Widget.
FlutterLineLiff().init(
config: Config(liffId: '{YOUR_LIFF_ID}'),
successCallback: () {},
errorCallback: (error) {},
);
copied to clipboard
Wait SDK Ready #
You could use all methods in FlutterLineLiff after SDK initialized.
FlutterLineLiff().ready.then((_) {
// SDK is ready now.
});
copied to clipboard
Get SDK and Account Information #
For all properties detail information, you could find it in LINE LIFF API Reference
// The property that holds the LIFF app ID passed to liff.init()
final String? id = FlutterLineLiff().id;

// Gets the environment in which the user is running the LIFF app.
final String? os = FlutterLineLiff().os;

// Gets the language settings of the environment in which the LIFF app is running.
final String language = FlutterLineLiff().language;

// Gets the version of the LIFF SDK.
final String version = FlutterLineLiff().version;

// Gets the user's LINE version.
final String? lineVersion = FlutterLineLiff().lineVersion;

// Gets the screen type
// (1-on-1 chat, group chat, multi-person chat, or external browser)
// from which the LIFF app is launched.
// For 1-on-1 chats, group chats, and multi-person chats, you also get a unique ID.
final Context? context = FlutterLineLiff().context;

// Determines whether the LIFF app is running in a LIFF browser.
final bool isInClient = FlutterLineLiff().isInClient;

// Checks whether the user is logged in.
final bool isLoggedIn = FlutterLineLiff().isLoggedIn;

// Checks whether the specified API is available in the environment
// where you started the LIFF app.
//
// Specifically, it verifies whether the current LINE version
// supports the API and whether the terms and conditions
// for the API have been accepted.
//
// Now [apiName] support: 'shareTargetPicker' | 'multipleLiffTransition'
final bool isApiAvailable = FlutterLineLiff().isApiAvailable(apiName: 'shareTargetPicker');

// Gets the current user's access token.
final String? accessToken = FlutterLineLiff().getAccessToken();

// Get the raw ID token of the current user obtained by the LIFF SDK.
// An ID token is a JSON Web Token (JWT) that contains user data.
final String? idToken = FlutterLineLiff().getIDToken();

// Gets the payload of the ID token that's acquired by the LIFF SDK.
// The payload includes information such as user display name,
// profile image URL, email address, etc.
final JWTPayload? decodedIDToken = FlutterLineLiff().getDecodedIDToken();
copied to clipboard
Profile #
Gets the current user's profile information.
final Profile profile = await FlutterLineLiff().profile;
copied to clipboard
Friendship #
Gets the friendship status between a user and a LINE Official Account.
final Friendship friendship = await FlutterLineLiff().friendship;
copied to clipboard
Login #
Performs the login process in the LINE's in-app browser or external browser.
FlutterLineLiff().login();

FlutterLineLiff().login(
config: LoginConfig(
redirectUri: 'xxxxxxxxxx'
),
);
copied to clipboard
Logout #
Logs out.
FlutterLineLiff().logout();
copied to clipboard
Permission #


Query
Verifies whether the user agrees to grant the specified permission.
final PermissionStatus status = FlutterLineLiff().permission.query(Permission.xxxx);
copied to clipboard


Request All
Displays the "Verification screen" for the permissions requested by LINE MINI Apps.
FlutterLineLiff().permission.requestAll();
copied to clipboard


Window #


Open Window
Opens the specified URL in the LINE's in-app browser or external browser.
FlutterLineLiff().openWindow(
params: OpenWindowParams(
url: 'xxxxxx',
external: false,
),
);
copied to clipboard


Close Window
Closes the LIFF app.
FlutterLineLiff().closeWindow();
copied to clipboard


Camera #
Launch the 2D code reader and obtain string. To activate the 2D code reader, turn on Scan QRon the LINE Developers Console.
final ScanCodeResult result = await FlutterLineLiff().scanCodeV2();
copied to clipboard
Message #


Send Messages
Sends messages on behalf of the user to the chat screen where the LIFF app is opened. This feature is only available in a LIFF app launched from a one-on-one chat room.
FlutterLineLiff().sendMessages(messages: [
TextMessage(),
ImageMessage(),
VideoMessage(),
AudioMessage(),
LocationMessage(),
StickerMessage(),
TemplateMessage(),
FlexMessage(),
])
copied to clipboard
sendCustomMessages could pass raw message Object to LIFF SDK.
FlutterLineLiff().sendCustomMessages(
messages: [
{
"type": "text",
"text": "Hello, World!"
}
],
)
copied to clipboard


ShareTargetPicker
Displays the target picker (screen for selecting a group or friend) and sends the message created by the developer to the selected target. This message appears to your group or friends as if you had sent it.
final ShareTargetResult? result = await FlutterLineLiff().shareTargetPicker(
messages: [
const TextMessage(
text: 'Share Target Test',
),
],
);
copied to clipboard


Permanent Link #


Create URL
// Get the permanent link of any page in the LIFF app.
final permanentUrl = await FlutterLineLiff().createUrlBy(url: '{Your url}')

// Gets the permanent link for the current page.
final permanentUrl = await FlutterLineLiff().createUrl();
copied to clipboard


Extra Query Parameters
// You can add any query parameter to a permanent link on the current page.
//
// Each time you execute `liff.permanentLink.setExtraQueryParam()`,
// the query parameters added last time are overwritten.
FlutterLineLiff().setExtraQueryParam(paramsToAdd: 'name1=value1&name2=value2');
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.