2222/// {@template error_handling}
2323/// This method redirects calls to the LINE SDK for the relevant native platform (iOS or Android).
2424/// If an error happens in the native platform, a [PlatformException] is thrown. See
25- /// [PlatformException.code] and [PlatformException.message] for error details.
25+ /// [PlatformException.code] and [PlatformException.message] for error details.
2626///
2727/// The LINE SDK implementation differs between iOS and Android, which means error codes and messages
2828/// can also be different. For platform-specific error information, see
3535part of flutter_line_sdk;
3636
3737/// A general manager class for LINE SDK login features.
38- ///
39- /// Don't create your own instance of this class. Instead, call [LineSDK.instance] to get a shared
38+ ///
39+ /// Don't create your own instance of this class. Instead, call [LineSDK.instance] to get a shared
4040/// singleton on which you can call other methods.
4141class LineSDK {
42-
4342 /// The method channel connected to the native side of the LINE SDK.
44- ///
43+ ///
4544 /// Don't use this channel directly. Instead, call the public methods on the [LineSDK] class.
4645 static const MethodChannel channel =
4746 const MethodChannel ('com.linecorp/flutter_line_sdk' );
48-
47+
4948 /// The shared singleton object of `LineSDK` .
50- ///
51- /// Always use this instance (rather than a self-created instance) to interact with the login
49+ ///
50+ /// Always use this instance (rather than a self-created instance) to interact with the login
5251 /// process of the LINE SDK.
5352 static final LineSDK instance = LineSDK ._();
5453
5554 LineSDK ._();
5655
5756 /// Sets up the SDK with a [channelId] and optional [universalLink] .
58- ///
57+ ///
5958 /// This method should be called once and only once, before any other methods in [LineSDK] .
60- /// Find your [channelId] in the [LINE Developers Console] (https://developers.line.biz/console).
61- ///
62- /// If you need to navigate from LINE back to your app via a universal link, you must also:
59+ /// Find your [channelId] in the [LINE Developers Console] (https://developers.line.biz/console).
60+ ///
61+ /// If you need to navigate from LINE back to your app via a universal link, you must also:
6362 /// 1. Specify the link URL in the LINE Developers Console
6463 /// 2. Prepare your server and domain to handle the URL
65- /// 3. Pass the URL in [universalLink] .
66- ///
67- /// For more about this, see the section "Universal Links support" in
68- /// [Setting up your project] (https://developers.line.biz/en/docs/ios-sdk/swift/setting-up-project/).
69- /// If you don't pass a [universalLink] in this method, LINE SDK will use the traditional URL
64+ /// 3. Pass the URL in [universalLink] .
65+ ///
66+ /// For more about this, see the section "Universal Links support" in
67+ /// [Setting up your project] (https://developers.line.biz/en/docs/ios-sdk/swift/setting-up-project/).
68+ /// If you don't pass a [universalLink] in this method, LINE SDK will use the traditional URL
7069 /// scheme to open your app when logging in through LINE.
7170 Future <void > setup (String channelId, {String universalLink}) async {
72- await channel.invokeMethod (
73- 'setup' ,
74- < String , String > {
75- 'channelId' : channelId,
76- 'universalLink' : universalLink
77- }
78- );
71+ await channel.invokeMethod ('setup' , < String , String > {
72+ 'channelId' : channelId,
73+ 'universalLink' : universalLink
74+ });
7975 }
8076
81- /// Logs the user into LINE with the specified [scopes] and [option] , by either opening the
82- /// LINE client for an existing logged in user, or a web view if the LINE client isn't installed
77+ /// Logs the user into LINE with the specified [scopes] and [option] , by either opening the
78+ /// LINE client for an existing logged in user, or a web view if the LINE client isn't installed
8379 /// on the user's device.
84- ///
85- /// By default, the login process uses only `"profile"` as its required scope. If you need
86- /// more scopes, put the ones you want (in addition to the default `"profile"` ) in [scopes] as a
87- /// list.
88- ///
89- /// If [scopes] contains `"profile"` , the user profile is returned in the result as
80+ ///
81+ /// By default, the login process uses only `"profile"` as its required scope. If you need
82+ /// more scopes, put the ones you want (in addition to the default `"profile"` ) in [scopes] as a
83+ /// list.
84+ ///
85+ /// If [scopes] contains `"profile"` , the user profile is returned in the result as
9086 /// [LoginResult.userProfile] . If `"profile"` is not included, the value of [LoginResult.userProfile]
91- /// will be null.
92- ///
93- /// An access token is issued if the user authorizes your app. This token, along with a refresh
94- /// token, is automatically stored in a secure place in your app for later use. You don't need to
95- /// refresh the access token manually. Any following API calls will try to refresh the access
87+ /// will be null.
88+ ///
89+ /// An access token is issued if the user authorizes your app. This token, along with a refresh
90+ /// token, is automatically stored in a secure place in your app for later use. You don't need to
91+ /// refresh the access token manually. Any following API calls will try to refresh the access
9692 /// token when necessary. However, you can refresh the access token manually with [refreshToken()] .
97- ///
98- /// You can control some other login behaviors, like whether to use a web page for login, or how
99- /// to ask the user to add your bot as a friend. To do so, create a [LoginOption] object and pass
93+ ///
94+ /// You can control some other login behaviors, like whether to use a web page for login, or how
95+ /// to ask the user to add your bot as a friend. To do so, create a [LoginOption] object and pass
10096 /// it to the [option] parameter.
101- ///
97+ ///
10298 /// {@macro error_handling}
10399 Future <LoginResult > login (
104- { List <String > scopes = const ["profile" ],
105- LoginOption option
106- }) async
107- {
108- String result = await channel.invokeMethod (
109- 'login' ,
110- < String , dynamic > {
111- 'scopes' : scopes,
112- 'onlyWebLogin' : option? .onlyWebLogin,
113- 'botPrompt' : option? .botPrompt
114- }
115- );
100+ {List <String > scopes = const ["profile" ], LoginOption option}) async {
101+ String result = await channel.invokeMethod ('login' , < String , dynamic > {
102+ 'scopes' : scopes,
103+ 'onlyWebLogin' : option? .onlyWebLogin,
104+ 'botPrompt' : option? .botPrompt
105+ });
116106 if (result == null ) return null ;
117107 return LoginResult ._(json.decode (result));
118108 }
119109
120110 /// Logs out the current user by revoking the related tokens.
121- ///
111+ ///
122112 /// {@macro error_handling}
123113 Future <void > logout () async {
124114 await channel.invokeMethod ('logout' );
125115 }
126116
127117 /// Gets the current access token in use.
128- ///
129- /// This returns a `Future<StoredAccessToken>` , with the access token value contained in the
130- /// result [StoredAccessToken.value] . If the user isn't logged in, it returns a `null` value as
131- /// the [Future] result.
132- ///
133- /// A valid [StoredAccessToken] object doesn't necessarily mean the access token itself is valid.
118+ ///
119+ /// This returns a `Future<StoredAccessToken>` , with the access token value contained in the
120+ /// result [StoredAccessToken.value] . If the user isn't logged in, it returns a `null` value as
121+ /// the [Future] result.
122+ ///
123+ /// A valid [StoredAccessToken] object doesn't necessarily mean the access token itself is valid.
134124 /// It may have expired or been revoked by the user from another device or LINE client.
135- ///
125+ ///
136126 /// {@macro error_handling}
137127 Future <StoredAccessToken > get currentAccessToken async {
138128 String result = await channel.invokeMethod ('currentAccessToken' );
@@ -141,9 +131,9 @@ class LineSDK {
141131 }
142132
143133 /// Gets the user’s profile.
144- ///
134+ ///
145135 /// Using this method requires the `"profile"` scope.
146- ///
136+ ///
147137 /// {@macro error_handling}
148138 Future <UserProfile > getProfile () async {
149139 String result = await channel.invokeMethod ('getProfile' );
@@ -152,14 +142,14 @@ class LineSDK {
152142 }
153143
154144 /// Refreshes the access token.
155- ///
145+ ///
156146 /// If the token refresh process finishes successfully, the refreshed access token will be
157147 /// automatically stored in the user's device. You can wait for the result of this method or get
158- /// the refreshed token with [currentAccessToken] .
159- ///
160- /// You don't need to refresh the access token manually. Any API call will attempt to refresh the
148+ /// the refreshed token with [currentAccessToken] .
149+ ///
150+ /// You don't need to refresh the access token manually. Any API call will attempt to refresh the
161151 /// access token when necessary.
162- ///
152+ ///
163153 /// {@macro error_handling}
164154 Future <AccessToken > refreshToken () async {
165155 String result = await channel.invokeMethod ('refreshToken' );
@@ -168,19 +158,19 @@ class LineSDK {
168158 }
169159
170160 /// Checks whether the stored access token is valid against the LINE authentication server.
171- ///
161+ ///
172162 /// {@macro error_handling}
173163 Future <AccessTokenVerifyResult > verifyAccessToken () async {
174164 String result = await channel.invokeMethod ('verifyAccessToken' );
175165 if (result == null ) return null ;
176166 return AccessTokenVerifyResult ._(json.decode (result));
177167 }
178168
179- /// Gets the friendship status between the user and the official account linked to your LINE Login
169+ /// Gets the friendship status between the user and the official account linked to your LINE Login
180170 /// channel.
181- ///
171+ ///
182172 /// Using this method requires the `"profile"` scope.
183- ///
173+ ///
184174 /// {@macro error_handling}
185175 Future <BotFriendshipStatus > getBotFriendshipStatus () async {
186176 String result = await channel.invokeMethod ('getBotFriendshipStatus' );
0 commit comments