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

[RFC]: Amplify core refactor #263

Closed
Amplifiyer opened this issue Dec 17, 2020 · 1 comment
Closed

[RFC]: Amplify core refactor #263

Amplifiyer opened this issue Dec 17, 2020 · 1 comment

Comments

@Amplifiyer
Copy link
Contributor

Amplifiyer commented Dec 17, 2020

This issue is a Request For Comments (RFC). It is intended to elicit community feedback regarding support for Amplify library in Flutter platform. Please feel free to post comments or questions here.

Purpose

Currently amplify-flutter library has a package amplify-core which customers use to import top level Amplify class. This amplify-core package is currently at top level and depends on all the plugin interface packages such as auth_plugin_interface making it impossible to add any base types to it which interface packages may need (creating a circular dependency between amplify-core and amplify_plugin_interface packages.

image

Proposed Solution

To be able to create base types in a bottom of the dependency hierarchy, we have two options:

Refactor amplify_core package

Rename the package to aws_amplify (or amplify_flutter) which will be a top level package that customers will import in their app. Use package amplify_core for adding base types and utils shared across amplify library and not used by customers.

This will be a breaking change for current developer preview customers as they will now import amplify as:

# pubspec.yaml
dependencies:
  flutter:
    sdk: flutter

  aws_amplify: 1.0.0
import 'package:aws_amplify/amplify.dart';
.
.
.
Amplify.DataStore.query(...);

Keep amplify_core as top level and create another package for base types

This new package can be called amplify_base. This will not be a breaking change immediately and customers will use amplify library as

# pubspec.yaml
dependencies:
  flutter:
    sdk: flutter

  amplify_core: 1.0.0
import 'package:amplify_core/amplify_core.dart';
.
.
.
Amplify.DataStore.query(...);

Let us know in comments if you prefer one way or the other or it doesn't impact you.

Appendix: Other Amplify platforms

JS

import Amplify, { DataStore } from 'aws-amplify';
import awsconfig from './aws-exports';

Amplify.configure(awsconfig);
DataStore.query();

iOS

import Amplify
import AmplifyPlugins

try Amplify.add(plugin: AWSDataStorePlugin())
try Amplify.configure()
Amplify.DataStore.query()

Android

import com.amplifyframework.core.Amplify
import com.amplifyframework.datastore.AWSDataStorePlugin

Amplify.addPlugin(AWSDataStorePlugin())
Amplify.configure()
Amplify.DataStore.query()
@Ashish-Nanda
Copy link
Contributor

Closing as we have picked option 1, and have an issue describing the upcoming breaking changes: #274

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