pick<T> method

Future<T?> pick<T>({
  1. dynamic params,
  2. int maxCount = 9,
})

选择图片

Implementation

Future<T?> pick<T>({dynamic params, int maxCount = 9}) async {
  if (_delegate == null) {
    throw StateError('Image picker delegate not set. Call setup() first.');
  }

  // 检查权限
  final hasPermission = await _delegate!.checkAuth();
  if (!hasPermission) {
    throw StateError('Image picker permission not granted');
  }

  try {
    final result = await _delegate!.pickImage(params, maxCount);
    return result is T ? result : null;
  } catch (e) {
    rethrow;
  }
}