Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on Android for me #21

Open
chris-rutkowski opened this issue Feb 23, 2021 · 1 comment
Open

Doesn't work on Android for me #21

chris-rutkowski opened this issue Feb 23, 2021 · 1 comment

Comments

@chris-rutkowski
Copy link

chris-rutkowski commented Feb 23, 2021

Hello, are you sure your plugin works on Android?
It works seamlessly on iOS but on Android it doesn't.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:save_in_gallery/save_in_gallery.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Home(),
    );
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('test')),
      body: ListView(
        children: [
          RaisedButton(
            child: Text('asset'),
            onPressed: () async {
              final url = 'assets/images/img.png';
              final bytes = await rootBundle.load(url);
              final res = await ImageSaver().saveImage(imageBytes: bytes.buffer.asUint8List());
              print('success $res');
            },
          )
        ],
      ),
    );
  }
}

The permission popup is displayed, however the console says

  • on Android always success false
  • on iOS always success true and I see it in the Photos app

Please advise

@donkii
Copy link

donkii commented Apr 19, 2021

What Android version are you using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants