Closed 94Sip closed 2 years ago
Hello @94Sip - Thanks for opening this issue. I was able to reproduce this. The latest release of the authenticator includes change to where Amplify is imported from, but the latest release of amplify_flutter does not include that change yet.
As a workaround until we get a new version of amplify_flutter released you can downgrade to amplify_authenticator: 0.1.0-rc.1
. However, please be aware that there will be some changes in how you use the authenticator in rc.1. See below for details. Also note that rc.1 does not include this fix for navigation.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Authenticator Demo',
home: Authenticator(
child: const Scaffold(
body: Center(
child: Text('You are logged in!'),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Authenticator(
child: MaterialApp(
title: 'Authenticator Demo',
builder: Authenticator.builder(),
home: const Scaffold(
body: Center(
child: Text('You are logged in!'),
),
),
),
);
}
@Jordan-Nelson Thank you Jordan - i was going a bit crazy thinking I had somehow corrupted my pub-cache.
To be clear, should I use rc.1 or rc.2? I read the linked fix thread, which highlights the documentation here, which appears to be rc.2
I'm more than willing to change because I don't think either of these will be a problem for me.
@94Sip right now you will need to use the following dependencies:
amplify_flutter: ^0.3.0-rc.3
amplify_auth_cognito: ^0.3.0-rc.3
amplify_authenticator: ^0.1.0-rc.1
And to use the Authenticator, the code in your app will look like
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Authenticator Demo',
home: Authenticator(
child: const Scaffold(
body: Center(
child: Text('You are logged in!'),
),
),
),
);
}
We are hoping to get a new release of amplify_flutter/amplify_auth_cognito that will allow you to switch back to the latest version of the amplify_authenticator.
New RC versions of all the libraries were released today. You can update to those versions now.
For the Authenticator, you will want to use the following dependencies:
amplify_flutter: 0.3.0-rc.4
amplify_auth_cognito: 0.3.0-rc.4
amplify_authenticator: 0.1.0-rc.3
Two things to note:
import 'package:amplify_flutter/amplify.dart';
in at least one location in your app. You will need to update this to import 'package:amplify_flutter/amplify_flutter.dart';
. This was a breaking change introduced in 0.3.0-rc.4
.@override
Widget build(BuildContext context) {
return Authenticator(
child: MaterialApp(
title: 'Authenticator Demo',
builder: Authenticator.builder(),
home: const Scaffold(
body: Center(
child: Text('You are logged in!'),
),
),
),
);
}
I am going to close this issue out. Thanks again for opening it and bringing it to our attention @94Sip
thank you very much!
@Jordan-Nelson I was able to get everything working - thank you.
One note: I had to go in to amplify CLI, and run 'amplify pull' to update my amplifyconfiguration.dart because this version of Authenticator expects there to be a usernameAttributes section in Auth configuration. For whatever reason, the previous of version of amplify CLI did NOT include this attribute. The error that was thrown explained this but I'm mentioning this because perhaps it is helpful as you move closer to a release, or you might want to include this in the documentation.
Describe the bug I am trying to use the new amplify_authenticator. I have setup my pubspec.yaml file as shown below, and which seems to follow the documentation for the amplify_authenticator (https://pub.dev/documentation/amplify_authenticator/latest/). I have also tried to build by specifying 0.3.0-rc.3 for the amplify_* packages, which also is giving me the same error.
dependencies: amplify_auth_cognito: ^0.3.0-0 amplify_authenticator: ^0.1.0-0 amplify_flutter: ^0.3.0-0 amplify_datastore: ^0.3.0-0 amplify_analytics_pinpoint: ^0.3.0-0 amplify_storage_s3: ^0.3.0-0 amplify_api: ^0.3.0-0
when i goto 'Run>Start Debugging' in VS Code I get the following error: : Error: Error when reading '../../../../flutter/.pub-cache/hosted/pub.dartlang.org/amplify_flutter-0.3.0-rc.3/lib/amplify_flutter.dart': The system cannot find the file specified. (screen shot captured below)
The source of this error appears to be the way that amplify_authenticator.dart is trying to import amplify_flutter. Amplify_authenticator.dart appears to be using the "old" way by importing "amplify_flutter.dart", not amplify.dart, which is the only present in amplify_flutter package.
Screenshots from Debug Terminal output
from amplify_authenticator.dart
Dependencies (
# Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: amplify_analytics_pinpoint: dependency: "direct main" description: name: amplify_analytics_pinpoint url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_analytics_plugin_interface: dependency: transitive description: name: amplify_analytics_plugin_interface url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_api: dependency: "direct main" description: name: amplify_api url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_api_plugin_interface: dependency: transitive description: name: amplify_api_plugin_interface url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_auth_cognito: dependency: "direct main" description: name: amplify_auth_cognito url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_auth_plugin_interface: dependency: transitive description: name: amplify_auth_plugin_interface url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_authenticator: dependency: "direct main" description: name: amplify_authenticator url: "https://pub.dartlang.org" source: hosted version: "0.1.0-rc.2" amplify_core: dependency: transitive description: name: amplify_core url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_datastore: dependency: "direct main" description: name: amplify_datastore url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_datastore_plugin_interface: dependency: transitive description: name: amplify_datastore_plugin_interface url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_flutter: dependency: "direct main" description: name: amplify_flutter url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_lints: dependency: "direct dev" description: name: amplify_lints url: "https://pub.dartlang.org" source: hosted version: "1.0.0" amplify_storage_plugin_interface: dependency: transitive description: name: amplify_storage_plugin_interface url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" amplify_storage_s3: dependency: "direct main" description: name: amplify_storage_s3 url: "https://pub.dartlang.org" source: hosted version: "0.3.0-rc.3" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted version: "3.1.8" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted version: "2.3.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted version: "2.8.2" authentication_repository: dependency: "direct main" description: path: "packages/authentication_repository" relative: true source: path version: "0.0.0" bloc: dependency: transitive description: name: bloc url: "https://pub.dartlang.org" source: hosted version: "8.0.2" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted version: "1.15.0" crypto: dependency: transitive description: name: crypto url: "https://pub.dartlang.org" source: hosted version: "3.0.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted version: "1.0.4" date_time_format: dependency: transitive description: name: date_time_format url: "https://pub.dartlang.org" source: hosted version: "2.0.1" equatable: dependency: "direct main" description: name: equatable url: "https://pub.dartlang.org" source: hosted version: "2.0.3" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted version: "1.2.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" flutter_bloc: dependency: "direct main" description: name: flutter_bloc url: "https://pub.dartlang.org" source: hosted version: "8.0.1" flutter_form_bloc: dependency: "direct main" description: name: flutter_form_bloc url: "https://pub.dartlang.org" source: hosted version: "0.29.3" flutter_keyboard_visibility: dependency: transitive description: name: flutter_keyboard_visibility url: "https://pub.dartlang.org" source: hosted version: "5.1.0" flutter_keyboard_visibility_platform_interface: dependency: transitive description: name: flutter_keyboard_visibility_platform_interface url: "https://pub.dartlang.org" source: hosted version: "2.0.0" flutter_keyboard_visibility_web: dependency: transitive description: name: flutter_keyboard_visibility_web url: "https://pub.dartlang.org" source: hosted version: "2.0.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints url: "https://pub.dartlang.org" source: hosted version: "1.0.4" flutter_localizations: dependency: transitive description: flutter source: sdk version: "0.0.0" flutter_native_splash: dependency: "direct dev" description: name: flutter_native_splash url: "https://pub.dartlang.org" source: hosted version: "1.3.3" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted version: "2.0.5" flutter_speed_dial: dependency: "direct main" description: name: flutter_speed_dial url: "https://pub.dartlang.org" source: hosted version: "5.0.0+1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" flutter_web_plugins: dependency: "direct main" description: flutter source: sdk version: "0.0.0" font_awesome_flutter: dependency: "direct main" description: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted version: "9.2.0" form_bloc: dependency: transitive description: name: form_bloc url: "https://pub.dartlang.org" source: hosted version: "0.29.1" form_inputs: dependency: "direct main" description: path: "packages/form_inputs" relative: true source: path version: "1.0.0+1" formz: dependency: transitive description: name: formz url: "https://pub.dartlang.org" source: hosted version: "0.4.1" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter url: "https://pub.dartlang.org" source: hosted version: "2.1.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted version: "2.1.5" http_parser: dependency: transitive description: name: http_parser url: "https://pub.dartlang.org" source: hosted version: "4.0.0" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted version: "3.1.0" intl: dependency: "direct main" description: name: intl url: "https://pub.dartlang.org" source: hosted version: "0.17.0" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted version: "0.6.3" json_annotation: dependency: transitive description: name: json_annotation url: "https://pub.dartlang.org" source: hosted version: "4.4.0" lints: dependency: transitive description: name: lints url: "https://pub.dartlang.org" source: hosted version: "1.0.1" location: dependency: "direct main" description: name: location url: "https://pub.dartlang.org" source: hosted version: "4.3.0" location_platform_interface: dependency: transitive description: name: location_platform_interface url: "https://pub.dartlang.org" source: hosted version: "2.3.0" location_web: dependency: transitive description: name: location_web url: "https://pub.dartlang.org" source: hosted version: "3.1.1" logger: dependency: "direct main" description: name: logger url: "https://pub.dartlang.org" source: hosted version: "1.1.0" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted version: "0.12.11" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted version: "1.7.0" nested: dependency: transitive description: name: nested url: "https://pub.dartlang.org" source: hosted version: "1.0.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted version: "1.8.0" petitparser: dependency: transitive description: name: petitparser url: "https://pub.dartlang.org" source: hosted version: "4.4.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted version: "2.1.2" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted version: "6.0.2" rxdart: dependency: transitive description: name: rxdart url: "https://pub.dartlang.org" source: hosted version: "0.27.3" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted version: "0.4.3" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted version: "1.3.0" universal_io: dependency: transitive description: name: universal_io url: "https://pub.dartlang.org" source: hosted version: "2.0.4" uuid: dependency: transitive description: name: uuid url: "https://pub.dartlang.org" source: hosted version: "3.0.5" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted version: "2.1.1" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted version: "5.3.1" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted version: "3.1.0" sdks: dart: ">=2.15.1 <3.0.0" flutter: ">=2.5.0"pubspec.lock
)