Giter Site home page Giter Site logo

bmob-flutter-sdk's People

Contributors

baikingrio avatar chaozhouzhang avatar chenmengdi avatar heshaoyue avatar jeffbmob avatar magic007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmob-flutter-sdk's Issues

BmobQuery中使用泛型传递表名出错

我的环境如下
• Flutter version 1.7.8+hotfix.4 at C:\some_explore\flutter
• Framework revision 20e59316b8 (5 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0

T.toString() 的结果是 BmobUser
T.runtimeType.toString() 的结果是 _Type
T is BmobUser 与 T.runtimeType is BmobUser 的结果均为 false

导致无法得到正确的表名 _User

建议修改表名传递

类之间没有Export连接

没有使用Export,导致引入一个文件不能获取所有功能,参考flutter其他库,均在入口文件export重要文件。减少学习成本,避免使用时去源码目录看目录名。

type 'String' is not a subtype of type 'Map<dynamic, dynamic>'

I/flutter ( 5231): Post请求启动! url:https://api2.bmob.cn/1/users ,body: {"smsCode":"594739","username":"FG ","mobilePhoneNumber":"13073636078"} ,headers:{content-type: null, X-Bmob-Application-Id: 28009b3f686439f09b5f81da404177fb, X-Bmob-REST-API-Key: e9f5e4b15c5b57631d280d0bcd49330d, Content-Type: application/json}
I/flutter ( 5231): Post请求结果:{"createdAt":"2021-08-10 20:04:35","mobilePhoneNumber":"13073636078","mobilePhoneNumberVerified":true,"objectId":"a425c6c147","sessionToken":"a390930140b625898085592bc36fa88d","updatedAt":"2021-08-10 20:04:35","username":"NBA"}
I/flutter ( 5231): type 'String' is not a subtype of type 'Map<dynamic, dynamic>'
I/flutter ( 5231): error

验证码登录接口,返回值为String?

 //Map转String
    //发送请求
///返回值类型为String,这里用Map接收
    Map result = await BmobDio.getInstance()
        .post(Bmob.BMOB_API_USERS, data: getParamsJsonFromParamsMap(data));
   
    print(result);

无法查询用户表数据

///查询单条数据
Future queryObject(objectId) async {
String tableName = T.toString();
if (T.runtimeType is BmobUser) {
tableName = "_User";
} else if (T.runtimeType is BmobInstallation) {
tableName = "_Installation";
}

return BmobDio.getInstance().get(
    Bmob.BMOB_API_CLASSES + tableName + Bmob.BMOB_API_SLASH + objectId,
    data: getParams());

}

上述通过T.runtimeType 去判断是用“_User”表还是“_Installation”表,操作是无效的,导致无法查询用户表数据

提几个建议

release 不要打印网络请求日志
访问的表名可以自定义而不是使用当前 dart 名称(需要考虑一些特殊情况,比如 Dart 混淆)

数据操作为什么不用future封装

别的无关的地方用,就关键的用的最多的数据操作没有future封装,更过分的是,你们的内部方法是async的然后就返回了一个void?这个封装你们真的是认真写的吗

WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.

官方案例, 就没成功过, 哎....

// 环境
[√] Flutter is fully installed. (Channel stable, v1.2.1, on Microsoft Windows [Version
10.0.17134.706], locale zh-CN)
[√] Android toolchain - develop for Android devices is fully installed. (Android SDK version 28.0.3)
[√] Android Studio is fully installed. (version 3.4)
[√] VS Code is fully installed. (version 1.33.1)
[√] Connected device is fully installed. (1 available)

//报错
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...

  • Error running Gradle:
    ProcessException: Process "D:\temp2\data_demo\android\gradlew.bat" exited abnormally:

Configure project :app
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Command: D:\temp2\data_demo\android\gradlew.bat app:properties

Finished with error: Please review your Gradle project setup in the android/ folder.

query.setOrder("-createdAt");不起作用哦。

  ///查询关联数据
  _queryPointer() {
    BmobQuery<Diary> query = BmobQuery();
    query.setInclude("author");
    query.setOrder("-createdAt");
    query.queryObjects().then((data) {
      List<Diary> blogs = data.map((i) => Diary.fromJson(i)).toList();
      print(blogs);
      for (Diary blog in blogs) {
        if (blog != null) {
          print(blog.objectId);
          print(blog.title);
          print(blog.content);
          if (blog.author != null) {
            print("rrrr"+blog.author.objectId + " yyyyyy "+ userId + blog.author.objectId.compareTo(userId).toString());
            if(blog.author.objectId.compareTo(userId) == 0){
              restaurants.add(blog);
              print(blog.author.objectId + "rrrr");
            }

          }
        }
      }
      setState(() {

      });
    }).catchError((e) {
      DataPlugin.toast(BmobError.convert(e).error);
    });
  }

BmobBatch#批量操作方法错误导致无法使用

data_plugin: ^0.0.18

Bmob的批量处理代码有bug,如下:

  • 问题1:
Future<List> process(String method, List<BmobObject> bmobObjects) async {
    List list = List();
    Map params = Map();

    SharedPreferences prefs = await SharedPreferences.getInstance();
    String userJson = prefs.get("user");
    print(userJson);
    BmobUser bmobUser;
    if (userJson != null) {
// 这里解析出来的是map类型,不能直接赋值给BmobUser
      bmobUser = json.decode(userJson);
    }
..........
}

上述问题,我已经本地修复了:

if (userJson != null) {
      var jsonSp = json.decode(userJson);
      bmobUser = BmobUser.fromJson(jsonSp);
    }

但是我看你们这边的接口貌似有问题,如下:

  • 问题2:
    我执行单个数据的插入时是没问题的,但是在使用该批量操作方法时会报错如下:“签名安全验证错误”

求解~~~

cupertino_icons: 冲突问题和建议使用equatable

这个 cupertino_icons 库版本差得有点多。

Because data_plugin >=0.0.18 depends on cupertino_icons ^0.1.3 and flutter_combat depends on cupertino_icons ^1.0.1, data_plugin >=0.0.18 is forbidden.
So, because flutter_combat depends on data_plugin ^0.0.18, version solving failed.
pub get failed (1; So, because flutter_combat depends on data_plugin ^0.0.18, version solving failed.)

dio plugin版本较低,建议升一下

dio plugin版本较低,建议升一下。
ecause data_plugin >=0.0.2 depends on dio ^1.0.12 and wanandroid_ngu depends on dio ^2.1.0, data_plugin >=0.0.2 is forbidden.

ios端没有实现这个方法DataPlugin.toast,报了一个异常

Unhandled Exception: MissingPluginException(No implementation found for method showToast on channel data_plugin)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:300:7)

#1 DataPlugin.toast (package:data_plugin/data_plugin.dart:22:20)

#2 _AddFishState._uploadFile. (package:menu/add_dish_route.dart:86:18)
#3 _rootRunUnary (dart:async/zone.dart:1132:38)
#4 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#5 _FutureListener.handleError (dart:async/future_impl.dart:144:20)
#6 Future._propagateToListeners.handleError (dart:async/future_impl.dart:651:47)
#7 Future._propagateToListeners (dart:async/future_impl.dart:672:24)
#8 Future._completeError (dart:async/future_impl.dart:491:5)
#9 _SyncCompleter._completeError (dart:async/future_impl.dart:55:12)

#10 _Completer.completeError (dart:async/future_impl.dart:27:5)

error occurs when use updateUserPassword

source code in bmob_user.dart

//Map转String
//发送请求
Map result = await BmobDio.getInstance().put(
Bmob.BMOB_API_REQUEST_UPDATE_USER_PASSWORD +
objectId,
data: getParamsJsonFromParamsMap(data));

the 'Bmob.BMOB_API_REQUEST_UPDATE_USER_PASSWORD' is

static const String BMOB_API_REQUEST_UPDATE_USER_PASSWORD = BMOB_API_VERSION + "/updateUserPassword";

the 'Bmob.BMOB_API_REQUEST_UPDATE_USER_PASSWORD' should be

static const String BMOB_API_REQUEST_UPDATE_USER_PASSWORD = BMOB_API_VERSION + "/updateUserPassword/";

关联查询问题

IOS和Android里的关联查询都有$relatedTo,为什么flutter里的却没有,官网举的例子也有问题,因为看代码并不能关联起来,求解答。

Update Android embedding

The plugin data_plugin uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.