Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Feb 4, 2024
1 parent b7f1dff commit 868f24d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/src/gal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ final class Gal {
/// Save a image to the gallery from [Uint8List].
///
/// Specify the album with [album]. If it does not exist, it will be created.
/// Do not include the extension in [name].
/// ```dart
/// await Gal.putImageBytes(bytes, name: 'photo');
/// ```
/// Throws an [GalException] If you do not have access premission or
/// if an error occurs during saving.
/// See: [Formats](https://github.com/natsuk4ze/gal/wiki/Formats)
static Future<void> putImageBytes(Uint8List bytes, {String? album, String name = 'image'}) async =>
static Future<void> putImageBytes(Uint8List bytes,
{String? album, String name = 'image'}) async =>
GalPlatform.instance.putImageBytes(bytes, album: album, name: name);

/// Open gallery app.
Expand Down
3 changes: 2 additions & 1 deletion lib/src/gal_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ final class MethodChannelGal extends GalPlatform {
}

@override
Future<void> putImageBytes(Uint8List bytes, {String? album, required final String name}) async {
Future<void> putImageBytes(Uint8List bytes,
{String? album, required String name}) async {
await requestAccess(toAlbum: album != null);
await _invokeMethod<void>(
'putImageBytes', {'bytes': bytes, 'album': album, 'name': name});
Expand Down
3 changes: 2 additions & 1 deletion lib/src/gal_platform_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ base class GalPlatform {

/// throw [UnimplementedError] when Plugin [MethodChannelGal] did not
/// define [putImageBytes].
Future<void> putImageBytes(Uint8List bytes, {String? album, required final String name}) =>
Future<void> putImageBytes(Uint8List bytes,
{String? album, required String name}) =>
throw UnimplementedError('putImageBytes() has not been implemented.');

/// throw [UnimplementedError] when Plugin [MethodChannelGal] did not
Expand Down

0 comments on commit 868f24d

Please sign in to comment.