当前位置: 首页 > 软件库 > 云计算 > >

amplify-flutter

授权协议 Apache-2.0 License
开发语言 C/C++
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 黄沈浪
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

AWS Amplify

Amplify Flutter

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service. See AWS Amplify for further details about the Amplify Framework.

We are iterating and looking for feedback and collaboration, so please let us know your feedback on our direction and roadmap.

⚠️ For breaking changes from the developer preview versions please refer to this issue for migration details.

Supported Amplify Categories

  • Authentication: APIs and building blocks for developers who want to create user authentication experiences with Amazon Cognito.

  • Analytics: Easily collect analytics data for your app with Pinpoint. Analytics data includes user sessions and other custom events that you want to track in your app.

  • Storage: Provides a simple mechanism for managing user content for your app in public, protected or private storage buckets with Amazon S3.
  • DataStore: A programming model for leveraging shared and distributed data without writing additional code for offline and online scenarios, which makes working with distributed, cross-user data just as simple as working with local-only data.
  • API (Rest): Provides a simple solution when making HTTP requests. It provides an automatic, lightweight signing process which complies with AWS Signature Version 4.
  • API (GraphQL): Interact with your GraphQL server or AWS AppSync API with an easy-to-use & configured GraphQL client.

To Be Implemented

  • Predictions
  • Storage Hub Events (Listening to the Amplify Storage events)

Amplify for Flutter currently supports iOS and Android platforms.

Documentation

Flutter Development Guide

Amplify for Flutter is an open-source project and welcomes contributions from the Flutter community, see Contributing.

Prerequisites

Getting Started with Flutter app development and Amplify

  • Clone this repository
  • Install Amplify in a Flutter project
  • Add basic Amplify functionality to your project using one of the supported categories
  1. git clone git@github.com:aws-amplify/amplify-flutter.git

  2. Open your Flutter project. If you do not have an active Flutter project, you can create one after installing the Flutter development tooling and running flutter create <project-name> in your terminal.

  3. Using the Amplify CLI, run amplify init from the root of your project:

See Amplify CLI Installation

==> amplify init
Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project helloAmplify
? Enter a name for the environment dev
? Choose your default editor: Visual Studio Code
? Choose the type of app that you\'re building flutter
Please tell us about your project
Only the following resource types are supported:
 * Auth
 * Analytics
 * Storage
 * API
? Where do you want to store your configuration file? ./lib/
  1. Add Amplify categories (choose defaults for this example):

    $ amplify add auth
    $ amplify add analytics
  2. Push changes to the cloud to provision the backend resources:

    $ amplify push
  3. In your pubspec.yaml file, add the following to dependencies:

Note: Do not include dependencies in your pubspec file that you are not using in your app. This can cause a configuration error in the underlying SDK.

dependencies:
  flutter:
    sdk: flutter
  amplify_flutter:
    path: /{path to your local amplify-flutter}/amplify-flutter/packages/amplify_flutter
  amplify_analytics_pinpoint:
    path: /{path to your local amplify-flutter}/amplify-flutter/packages/amplify_analytics_pinpoint
  amplify_auth_cognito:
    path: /{path to your local amplify-flutter}/amplify-flutter/packages/amplify_auth_cognito
  1. From the terminal run
flutter pub get
  1. In your main.dart file, add:
import 'package:flutter/material.dart';
import 'package:amplify_flutter/amplify.dart';
import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart';
import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';

import 'amplifyconfiguration.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _amplifyConfigured = false;

  @override
  void initState() {
    super.initState();
  }

  void _configureAmplify() async {
    if (!mounted) return;

    // Add Pinpoint and Cognito Plugins
    Amplify.addPlugin(AmplifyAuthCognito());
    Amplify.addPlugin(AmplifyAnalyticsPinpoint());

    // Once Plugins are added, configure Amplify
    try {
      await Amplify.configure(amplifyconfig);
      setState(() {
        _amplifyConfigured = true;
      });
    } on AmplifyAlreadyConfiguredException {
      print(
          "Amplify was already configured. Looks like app restarted on android.");
    }

  }

  // Send an event to Pinpoint
  void _recordEvent() async {
    AnalyticsEvent event = AnalyticsEvent('test');
    event.properties.addBoolProperty('boolKey', true);
    event.properties.addDoubleProperty('doubleKey', 10.0);
    event.properties.addIntProperty('intKey', 10);
    event.properties.addStringProperty('stringKey', 'stringValue');
    Amplify.Analytics.recordEvent(event: event);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Amplify example app'),
          ),
          body: ListView(padding: EdgeInsets.all(10.0), children: <Widget>[
            Center(
              child: Column (
                children: [
                  const Padding(padding: EdgeInsets.all(5.0)),
                  ElevatedButton(
                    onPressed: _amplifyConfigured ? null : _configureAmplify,
                    child: const Text('configure Amplify')
                  ),
                  ElevatedButton(
                    onPressed: _amplifyConfigured ? _recordEvent : null,
                    child: const Text('record event')
                  )
                ]
              ),
            )
          ])
      )
    );
  }
}

For iOS builds complete the following steps (from the root of your project):

  • rm ios/Podfile
  • flutter build ios
  • Modify the ios/Podfile and replace the second line with: platform :ios, '11.0'.

This ensures that your Flutter project is running the same ios version that the Amplify plugins are built on.

  1. From the root of your project, execute flutter run in the terminal.

Make sure that an Android or iOS device is already running; this can be a virtual device started from Android Studio.

Click Configure Amplify, then Record Event. From the terminal (in the root of your project) run amplify console analytics. This will open the Amazon Pinpoint console for your project in your default web browser. Within about a minute you should start seeing the events populating in the Events section of then Pinpoint console.

For further documentation and Amplify Category API usage, see the documentation.


Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.

  • 问题描述 MAC, Android Studio 4.1环境, 安装flutter插件并重启后在终端运行flutter doctor却报错,具体如下 ~ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 1.22.3, on Mac OS

  • Platform 在dart:io中,提供与Platform类的API奇偶校验,但使用实例属性而不是静态属性。这种差异允许在测试中使用这些API,您可以在其中提供模拟实现。 看一下构造方法: class Platform { static int get numberOfProcessors => _numberOfProcessors; static String get pathSe

  • 直接结论,哈哈哈: Plugin 'XXXXXX' is incompatible with this installation,选择选择的插件COMPATIBILITY 的XXX 与idea编辑器的Help->About查看到的Build.XXX匹配即可 如题,在搭建Flutter的时候,按照Flutter 中文网的来,但是由于网络问题,在Plugins->Browse repositories

  • 上一篇简单的整理了一下Podspec语法整理,主要是为了这一篇Flutter中iOS原生模块开发。 简介 在开发Flutte中我们难免会遇到原生组件、插件或者与原生模块通信,比如地图、引入第三方sdk如微信、支付宝等SDK,还有摄像头SDK,我们必须要用到原生, 当然你也可以用pub.dev/flutter中的,但是这并不是最终的解决之道,Flutter刚发展不久,假如刚好没有或者并不满足你的需求

  • 用途 名称 网络请求 dio 屏幕适配 flutter_screenutil UI weui(仿微信 ) UI bruno(贝壳团队出品 ) 轮播图 flutter_swiper 本地存储 shared_preferences 下拉刷新,上拉加载 flutter_easyrefresh 选择器 flutter_pickers 事件总线 event_bus 评分 flutter_rating_bar

  • 搜索plugins flutter plugins搜索地址 谷歌官方plugins https://pub.dev/packages?q=http 到这个链接里面去搜索 https://github.com/flutter/plugins 官方的plugins列表 cupertino_icons Default icons asset used by Flutter's Cupertino wid

 相关资料
  • Amplify’s request adds some additional features to jQuery’s ajax method while abstracting away the underlying data source.

  • Reporting Bugs/Feature Requests AWS Amplify CLI The AWS Amplify CLI is a toolchain which includes a robust feature set for simplifying mobile and web application development. The CLI uses AWS CloudFor

  • Amplify 用于与使用 JavaScript 应用程序的云服务进行交互。AWS Amplify 库分为多个类别,并计划在未来增加更多分类。 这是一个跨越不同类别操作的声明性接口,以便将常见任务更容易地添加到应用程序中。默认实现适用于Amazon Web Services(AWS)资源,但设计为可打开并可插入,以便与其他云服务提供一个可实现的或自定义后端。 当前类别以授权开始。程序员可以使用它为

  • 用于使用云服务进行应用程序开发的声明性 JavaScript 库。 AWS Amplify 为不同类别的云操作提供了一个声明性且易于使用的界面。 AWS Amplify 适用于任何基于 JavaScript 的前端工作流程,适用于移动开发人员的 React Native。 我们的默认实现适用于亚马逊网络服务(AWS),但 AWS Amplify 旨在为任何自定义后端或服务开放和可插入。 特性/AP

  • Awesome AWS Amplify curates the best AWS Amplify, tools, tutorials, articles and more. PRs are welcome! Check out the Amplify Discord server Getting Started Github Documentation Workshops Serverless G

  • AWS Amplify Vue Starter A VueJs starter app integrated with aws-amplify. Please submit issues to the aws-amplify repository. Getting Started AWS Amplify Integration Explained Setup AWS Amplify Auth Ro