BitLyShortener class
class to work with bit.ly links
Example to create a simple short link:--
try{
final shortener = BitLyShortener(
accessToken: "YOUR_TOKEN",
);
BitLyLinkData linkData=await shortener.generateShortLink(longUrl: 'ANY_URL');
print(linkData.link);
}
on BitLyException catch(e){ //For handling BitLyException
print(e);
}
on Exception catch(e){ // For handling other Exceptions related to http package
print(e);
}
Check out official documentation for more info.
Constructors
- BitLyShortener({required String accessToken})
Properties
- accessToken → String
-
Access Token is required and must not be null or empty
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
generateBitLyLink(
{required BitLinkParameters parameters, required String longUrl, String domain = "bit.ly", String? groupGuid}) → Future< BitLyLinkData> - Official Documentation :- Converts a long url to a Bitlink and sets additional parameters.
-
generateShortLink(
{required String longUrl, String domain = "bit.ly", String? groupGuid}) → Future< BitLyLinkData> - Official Documentation:- Converts a long url to a Bitlink.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
retrieveBitLyLink(
{required String link}) → Future< BitLyLinkData> - Official Documentation :- Returns information for the specified link...
-
toString(
) → String -
A string representation of this object.
inherited
-
updateBitLyLink(
{required BitLyLinkData linkData}) → Future< BitLyLinkData> - Official Documentation :- Updates fields in the specified link...
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited