konifar / droidkaigi2018-flutter

The unofficial conference app for DroidKaigi 2018 Tokyo
https://itunes.apple.com/app/id1341774412
Apache License 2.0
508 stars 103 forks source link

Update cloud_firestore version because 0.2.6 is not derived #65

Closed gen0083 closed 6 years ago

gen0083 commented 6 years ago

Issue

I got error when run flutter packages get.

Running "flutter packages get" in droidkaigi2018-flutter...
Package cloud_firestore has no versions that match 0.2.6 derived from:
- droidkaigi2018 depends on version 0.2.6
pub get failed (1)

Overview

Update cloud_firestore version (actually it used 0.2.12 in my machine)

sho5nn commented 6 years ago

I think that cloud_firestore version should be 0.2.9.

Because, some a library interface has been changed between 0.2.9 and 0.2.10 and later.

// 0.2.9

part of cloud_firestore;

class DocumentReference {

  Future<Null> setData(Map<String, dynamic> data, [SetOptions options]) {
    return Firestore.channel.invokeMethod(
      'DocumentReference#setData',
      <String, dynamic>{'path': path, 'data': data, 'options': options?._data},
    );
  }
// 0.2.10

part of cloud_firestore;

class DocumentReference {

  Future<void> setData(Map<String, dynamic> data, [SetOptions options]) {
    return Firestore.channel.invokeMethod(
      'DocumentReference#setData',
      <String, dynamic>{'path': path, 'data': data, 'options': options?._data},
    );
  }

This change affects return type of FavoriteRepository#update().

// droidkaigi2018-flutter : favorite_repository_impl.dart

class FavoriteRepositoryImpl extends FavoriteRepository {

  Future<Null> update(String userId, String sessionId, bool favorite) async {
    return await _firestore
        .collection("users/$userId/favorites")
        .document(sessionId)
        .setData({'favorite': favorite}).then((result) {
      _cache[sessionId] = favorite;
      return result;
    });
  }

@gen0083 @konifar Can you change version to 0.2.9 ❓😃

gen0083 commented 6 years ago

Thank you for great suggestion @sho5nn ! and sorry for late response 🙇 I tried version 0.2.9 and it looks fine.

But I think this PR is too small to useful. On Flutter version 0.3.1 (Dart 2.0.0-dev.48.0.flutter-fe606f890b) there are some errors in this project. I'll send another PR to adopt flutter 0.3.1, and this PR close.