Aquarius_Girl
Aquarius_Girl

Reputation: 22946

Open_file doesn't actually open the pdf in Android emulater

The import statement:
import 'package:open_file/open_file.dart';

The button responsible for opening the pdf:

ElevatedButton(  
                 child: Text('SignUpdasdasdas', style: TextStyle(fontSize: 2.0),),  
                 onPressed: () { OpenFile.open("assets/qwe.pdf"); },  
              ),

The pubspec.yaml:

dependencies:
  open_file: ^3.2.1

flutter:
  assets:
      - assets/

Terminal:

-iMac assets % pwd
/Users/reena/office/flutter/office_project_demo/buttons/assets

-iMac assets % ls
abc.txt qwe.pdf

-iMac assets % 

There are no errors shown. qwe.pdf is a valid pdf.
I expect the pdf file to actually open open on the screen of the Android Emulator.

What am I doing wrong?

Upvotes: 0

Views: 308

Answers (1)

Yuri H
Yuri H

Reputation: 680

YAML is space sensitive - check that there are exactly two spaces in front of the assets string

flutter:
  assets:
    - assets/
  ^^ two spaces, not 4 

Upvotes: 1

Related Questions