shyun_link 3.0.1
shyun_link: ^3.0.1 copied to clipboard
Streamlined deeplink and short URL management with Clean Architecture. Focused on core functionality - ShyunLinkManager.createShortLink() and deeplink handling with multiple URL format support.
ShyunLink #
Streamlined deeplink and short URL management with Clean Architecture
ShyunLink provides focused deeplink and short URL management for Flutter apps. Version 3.1.0 is streamlined to focus on core functionality - ShyunLinkManager.createShortLink()
and deeplink handling with support for multiple URL formats.
โจ v3.1.0 Core Features #
- ๐ฏ Focused API: Streamlined to essential functionality
- ๐ Short Link Creation: Template-based URL generation with
ShyunLinkManager.createShortLink()
- ๐ฑ Deeplink Handling: Robust support for 4 deeplink formats (parameterized, direct, web URL, fallback)
- ๐๏ธ Clean Architecture: Strategy Pattern for extensible deeplink processing
- โก Lightweight: Reduced dependencies and package size
- ๐งน Clean Codebase: Removed unnecessary features for better maintainability
Quick Start #
Installation #
Add this to your pubspec.yaml
:
dependencies:
shyun_link: ^3.1.0
app_links: ^3.4.3 # Optional for deeplink handling
Setup #
1. Initialize ShyunLink
import 'package:flutter/material.dart';
import 'package:shyun_link/shyun_link.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize ShyunLink system
await ShyunLinkManager.initialize(
appScheme: 'myapp',
webBaseUrl: 'https://myapp.com',
apiServerUrl: 'https://api.myapp.com', // Optional
onDeepLink: (context) {
// Handle deeplink navigation
Navigator.pushNamed(
navigatorKey.currentContext!,
context.route,
arguments: context.params,
);
},
);
runApp(MyApp());
}
2. Native Platform Setup
For deeplinks to work properly, you need native configuration:
- Android: Add intent-filter to
android/app/src/main/AndroidManifest.xml
- iOS: Add URL scheme to
ios/Runner/Info.plist
See Platform Setup Guide for detailed instructions.
Core Usage #
Create Short Links #
// Create store link with new template pattern
final storeLink = await ShyunLinkManager.createShortLink(
pageName: 'store',
pageType: 'store',
pageId: 123,
);
// Create curation link
final curationLink = await ShyunLinkManager.createShortLink(
pageName: 'curationDetail',
pageType: 'curation',
pageId: 456,
);
// Simple page link (no ID required)
final eventLink = await ShyunLinkManager.createShortLink(
pageName: 'event',
pageType: 'event-promotion',
);
Handle Deeplinks #
ShyunLink automatically handles 4 types of deeplink formats:
// 1. Parameterized: myapp://page?type=store&id=123
// 2. Direct path: myapp://store/123
// 3. Web URL: https://myapp.com/store/123
// 4. Fallback: Unknown formats โ home page
Get Link Information #
// Get details about a short link
final linkInfo = await ShyunLinkManager.getLinkInfo(shortUrl);
if (linkInfo != null) {
print('Original URL: ${linkInfo.originalUrl}');
print('Created: ${linkInfo.createdAt}');
}
Supported Deeplink Formats #
ShyunLink handles these deeplink formats automatically:
# 1. Parameterized (Query-based)
myapp://page?type=store&id=123
myapp://curationDetail?type=curation&id=456
# 2. Direct Path
myapp://store/123
myapp://curationDetail/456
# 3. Web URLs (Universal/App Links)
https://myapp.com/store/123
https://myapp.ly/abc123
# 4. Fallback (Unknown โ Home)
myapp://unknown-page โ Redirects to home
Testing Deeplinks #
# Android (ADB)
adb shell am start -W -a android.intent.action.VIEW -d "myapp://store/123" com.example.myapp
# iOS (Simulator)
xcrun simctl openurl booted "myapp://store/123"
# Web testing
open "https://myapp.com/store/123"
Migration from v3.0.x #
Removed Features #
If you were using sharing features, implement them externally:
// Before (v3.0.x)
await ShyunLinkManager.shareStore(123, customText: 'Check this out!');
// After (v3.1.0) - Create link then share manually
final shortUrl = await ShyunLinkManager.createShortLink(
pageName: 'store',
pageType: 'store',
pageId: 123,
);
// Use share_plus or other sharing package
await Share.share('Check this out!\n\n$shortUrl');
Documentation #
- Platform Setup Guide - Android/iOS native configuration
- Architecture Guide - Clean Architecture overview
- API Reference - Complete API documentation
Example #
Check the example directory for a complete implementation:
- โ Android/iOS native configuration
- โ ShyunLinkManager API demonstration
- โ Deeplink testing utilities
- โ Core functionality showcase
Contributing #
Bug reports, feature suggestions, and contributions are welcome! Please create an issue or submit a Pull Request.
License #
This project is licensed under the MIT License. See the LICENSE
file for details.