Skip to content

Commit

Permalink
More strongly typing
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Jul 5, 2023
1 parent 6950fe6 commit e2acabb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/src/gal.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:gal/src/gal_exception.dart';

Expand All @@ -6,13 +7,14 @@ import 'gal_platform_interface.dart';
/// For detailed please see
/// https://github.com/natsuk4ze/gal/wiki
/// these functions are first called,
/// [putImage],[putVideo],[putImageBytes],a native dialog is
/// [putImage],[putVideo],[putImageBytes],a native dialog is
/// called asking the use for permission. If the user chooses to deny,
/// [GalException] of [GalExceptionType.accessDenied] will be throwed.
/// You should either do error handling or call [requestAccess] once
/// before calling these function.
@immutable
final class Gal {
Gal._();
const Gal._();

/// Save video to standard gallery app
/// [path] is local path.
Expand Down
6 changes: 5 additions & 1 deletion lib/src/gal_exception.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'package:flutter/foundation.dart';

/// Every [Exception] that [Gal] throws should be this.
@immutable
class GalException implements Exception {
GalException({
const GalException({
required this.type,
required this.error,
required this.stackTrace,
Expand Down
1 change: 1 addition & 0 deletions lib/src/gal_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'gal_platform_interface.dart';

/// Plugin Communication
@immutable
final class MethodChannelGal extends GalPlatform {
@visibleForTesting
final methodChannel = const MethodChannel('gal');
Expand Down

0 comments on commit e2acabb

Please sign in to comment.