flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

flutter_secure_storage does not work on Windows.

Open astudilloalex opened this issue 3 years ago • 15 comments

Hello, the package show a error when try launch on Windows.

Platform: Windows Package version: 5.0.2

This is my pubspec.yaml file:

name: pharmacy_billing_system
description: A new Flutter project.

publish_to: 'none' 

version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_secure_storage: ^5.0.2
  get: ^4.6.1
  google_fonts: ^2.3.1
  http: ^0.13.4
  responsive_design: ^0.0.21

dev_dependencies:
  flutter_test:
    sdk: flutter
  lint: ^1.8.2

flutter:
  uses-material-design: true

Just declare the package, I'm not using it yet but I'm getting the following error.

Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
[D:\Users\Alex\Documents\FlutterProjects\pharmacy_billing_system\windows\flutter\ephemeral\.plugin_symlinks\flutter_secure_storage_windows\windows\flutter_secure_storage_windows_plugin.cpp]()(6,10): fatal error C1083: Cannot open include file: 'atlstr.h': No such file or directory [[D:\Users\Alex\Documents\FlutterProjects\pharmacy_billing_system\build\windows\plugins\flutter_secure_storage_windows\flutter_secure_storage_windows_plugin.vcxproj]()]
Exception: Build process failed.
Exited (sigterm)

image

The software works fine if I remove the dependency from my pubspec.yaml.

astudilloalex avatar Mar 09 '22 16:03 astudilloalex

Help with this error

Hello, the package show a error when try launch on Windows.

Platform: Windows Package version: 5.0.2

This is my pubspec.yaml file:

name: pharmacy_billing_system
description: A new Flutter project.

publish_to: 'none' 

version: 1.0.0+1

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_secure_storage: ^5.0.2
  get: ^4.6.1
  google_fonts: ^2.3.1
  http: ^0.13.4
  responsive_design: ^0.0.21

dev_dependencies:
  flutter_test:
    sdk: flutter
  lint: ^1.8.2

flutter:
  uses-material-design: true

Just declare the package, I'm not using it yet but I'm getting the following error.

Launching lib\main.dart on Windows in debug mode...
lib\main.dart:1
[D:\Users\Alex\Documents\FlutterProjects\pharmacy_billing_system\windows\flutter\ephemeral\.plugin_symlinks\flutter_secure_storage_windows\windows\flutter_secure_storage_windows_plugin.cpp]()(6,10): fatal error C1083: Cannot open include file: 'atlstr.h': No such file or directory [[D:\Users\Alex\Documents\FlutterProjects\pharmacy_billing_system\build\windows\plugins\flutter_secure_storage_windows\flutter_secure_storage_windows_plugin.vcxproj]()]
Exception: Build process failed.
Exited (sigterm)

image

The software works fine if I remove the dependency from my pubspec.yaml.

Help with this error.

astudilloalex avatar Apr 23 '22 19:04 astudilloalex

You need to install [Visual Studio 2022 Community] as explained here: https://docs.flutter.dev/get-started/install/windows#additional-windows-requirements

jbrechbuehl avatar Apr 30 '22 01:04 jbrechbuehl

You need to install [Visual Studio 2022 Community] as explained here: https://docs.flutter.dev/get-started/install/windows

I have installed Visual Studio, the app work correctly in Windows if delete the package, when add package the app breaks

astudilloalex avatar May 01 '22 02:05 astudilloalex

I have the same error which this package. Visual Studio and "Desktop development with C++" are installed and in general Windows builds for Flutter do work.

brookman avatar May 11 '22 08:05 brookman

Hi, I also have this issue, I'm using VSCode with Flutter 3.0.0 and updated extension, the Windows build works fine, but after adding the package flutter_secure_storage my app stop working and show the same message above.

mibi2007 avatar May 20 '22 10:05 mibi2007

Install the individual components of 'atlstr.h' as shown in the video: https://www.youtube.com/watch?v=Lq3SllRv7a8

If you have bad UTF-8 issues, go to: https://github.com/flutter/flutter/issues/102451#issuecomment-1124651845

ViniciusLima avatar Jun 01 '22 16:06 ViniciusLima

Install the individual components of 'atlstr.h' as shown in the video: https://www.youtube.com/watch?v=Lq3SllRv7a8

If you have bad UTF-8 issues, go to: flutter/flutter#102451 (comment)

This worked for me. Thanks man!

TreyThomas93 avatar Jun 05 '22 14:06 TreyThomas93

You need to install [Visual Studio 2022 Community] as explained here: https://docs.flutter.dev/get-started/install/windows

Moving to VS 2022 worked for me, Thanks man

ijaspreetsinghh avatar Sep 22 '22 07:09 ijaspreetsinghh

I successfully run the app after adding this in "Visual Studio Build Tools 2022" installation. Open Visual Studio Installer, click modify in existing installation, see optional items in right panel image

nridwan avatar Dec 14 '22 06:12 nridwan

C++ ATL is enough btw C++ MFC is not required to build

DoumanAsh avatar Mar 01 '23 07:03 DoumanAsh

I was able to patch the package within VS Code on windows to build for windows desktop. I plan to add my process in a following comment.

Glitched-Manual avatar Apr 07 '24 09:04 Glitched-Manual

Alright. I have linked an example with the solution in the README.md for ease of access. https://github.com/Glitched-Manual/quick_secure_storage_patch

Glitched-Manual avatar Apr 07 '24 11:04 Glitched-Manual

quick_secure_storage_patch

Editor: VS Code

Create a new Flutter project

  • If you already. Skip this step.

Open a new terminal in VS Code

Install flutter_secure_storage:

flutter pub add flutter_secure_storage

Add the flutter_secure_storage import

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

Run windows desktop build

  • Project will fail (thats fine)

Run the following commands to copy files to where they are needed

cp "windows/flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_windows/windows/*.*" "windows/flutter/ephemeral/"
cp "windows/flutter/ephemeral/atls.lib" "build/windows/x64/plugins/flutter_secure_storage_windows/"

Run windows desktop build (twice) ((yes run 2 times))

  • And you are done.

Glitched-Manual avatar Apr 07 '24 11:04 Glitched-Manual

The issue does not take long to solve. What is happening:

On getting the fatal error C1083: Cannot open include file: 'atlstr.h'.

The builder just not able to find the package CPP files needed.

After installing flutter_secure_storage. with:

flutter pub add flutter_secure_storage

The files needed are located in /your_flutter_project_path/windows/flutter/ephemeral/.plugin_symlinks/flutter_secure_storage_windows/windows/

The .cpp , .h , .dll, and .lib files need to be copied to /your_flutter_project_path/windows/flutter/ephemeral/

Then 'atls.lib' needs to be copied to the location of the flutter_secure_storage_windows_plugin.vcxproj file: /your_flutter_project_path/build/windows/x64/plugins/flutter_secure_storage_windows/

Then running the debugger builds and object file that is needed.

Then you are in the clear.

*******This Issue Can be Closed *******

Glitched-Manual avatar Apr 07 '24 11:04 Glitched-Manual