Initial project
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
|
||||
class ProtocolSdkMethodChannel
|
||||
{
|
||||
// Channel Name
|
||||
static const String channelName = 'protocol_sdk';
|
||||
|
||||
//---------------- Flutter call native ----------------
|
||||
|
||||
static const String requestPermission = 'requestPermission';
|
||||
|
||||
|
||||
//---------------- Flutter call native ----------------
|
||||
|
||||
|
||||
|
||||
//---------------- native call Flutter ----------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------- native call Flutter ----------------
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import '../../../protocol_sdk_platform_interface.dart';
|
||||
|
||||
class ProtocolSdkMethodChannelDataSource
|
||||
{
|
||||
|
||||
final ProtocolSdkPlatform platform;
|
||||
|
||||
ProtocolSdkMethodChannelDataSource(this.platform);
|
||||
|
||||
|
||||
Future<String?> getPlatformVersion() async {
|
||||
return await getPlatformVersion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/// Data Transfer Object
|
||||
/// - 只負責資料傳輸 / 解析
|
||||
/// - 結構可變
|
||||
/// - 可以依賴 JSON / platform
|
||||
class ProtocolSdkPermissionStatusDto {
|
||||
final bool granted;
|
||||
final bool permanentlyDenied;
|
||||
final String? grantedAt; // 通常是 raw string
|
||||
|
||||
ProtocolSdkPermissionStatusDto({
|
||||
required this.granted,
|
||||
required this.permanentlyDenied,
|
||||
this.grantedAt,
|
||||
});
|
||||
|
||||
factory ProtocolSdkPermissionStatusDto.fromJson(
|
||||
Map<String, dynamic> json,
|
||||
) {
|
||||
return ProtocolSdkPermissionStatusDto(
|
||||
granted: json['granted'] as bool,
|
||||
permanentlyDenied: json['permanentlyDenied'] as bool,
|
||||
grantedAt: json['grantedAt'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
//Repository Impl
|
||||
|
||||
import '../../domain/repositories/protocol_sdk_repository.dart';
|
||||
import '../datasources/protocol_sdk_method_channel_datasource.dart';
|
||||
|
||||
class ProtocolSdkRepositoryImpl implements ProtocolSdkRepository
|
||||
{
|
||||
final ProtocolSdkMethodChannelDataSource _datasource;
|
||||
|
||||
const ProtocolSdkRepositoryImpl(this._datasource);
|
||||
|
||||
@override
|
||||
Future<String?> platformVersion() {
|
||||
return _datasource.getPlatformVersion();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user