Giter Site home page Giter Site logo

flutter 2.x bug about flutter_session HOT 3 OPEN

jhourlad avatar jhourlad commented on August 30, 2024 1
flutter 2.x bug

from flutter_session.

Comments (3)

peterbyCom avatar peterbyCom commented on August 30, 2024 1

[study] flutter pub get
Running "flutter pub get" in study...
Because shared_preferences_linux >=0.0.4-nullsafety <2.0.0 depends on shared_preferences_platform_interface ^2.0.0-nullsafety and shared_preferences_linux <=0.0.2 depends on path_provider ^1.6.11, shared_preferences_linux <0.0.2+1 or >=0.0.4-nullsafety <2.0.0-∞ requires shared_preferences_platform_interface ^2.0.0-nullsafety or path_provider ^1.6.11.

And because shared_preferences_linux >=0.0.2+1 <0.0.4-nullsafety depends on path_provider_linux ^0.0.1, shared_preferences_linux <2.0.0 requires path_provider_linux ^0.0.1 or shared_preferences_platform_interface ^2.0.0-nullsafety or path_provider ^1.6.11.

And because shared_preferences >=0.5.8 <2.0.0-nullsafety depends on shared_preferences_linux ^0.0.2 and shared_preferences >=0.5.4+8 <2.0.0-nullsafety depends on shared_preferences_platform_interface ^1.0.0, shared_preferences >=0.5.8 <2.0.0-nullsafety requires path_provider_linux ^0.0.1 or path_provider ^1.6.11.

And because path_provider 2.0.1 depends on path_provider_linux ^2.0.0 and no versions of path_provider match >2.0.1 <3.0.0, shared_preferences >=0.5.8 <2.0.0-nullsafety is incompatible with path_provider ^2.0.1.

Because no versions of better_player match >0.0.62 <0.1.0 and better_player 0.0.62 depends on path_provider ^2.0.1, better_player ^0.0.62 requires path_provider ^2.0.1.

Thus, better_player ^0.0.62 is incompatible with shared_preferences >=0.5.8 <2.0.0-nullsafety.

And because every version of flutter_session depends on shared_preferences ^0.5.8, better_player ^0.0.62 is incompatible with flutter_session.

So, because study depends on both flutter_session ^0.1.1 and better_player ^0.0.62, version solving failed.
pub get failed (1; So, because study depends on both flutter_session ^0.1.1 and better_player ^0.0.62, version solving failed.)
exit code 1

from flutter_session.

itamarjp avatar itamarjp commented on August 30, 2024

same problem here, please update it.

from flutter_session.

RasyidMF avatar RasyidMF commented on August 30, 2024

I think the owner of this package never do update anymore, so the solution just make directory and call it as module/deprecated/flutter_session and create file called flutter_session.dart. Also don't forgot to add package called shared_preferences

/// Copyright (c) 2020, Jhourlad Estrella.
/// All rights reserved. Use of this source code is governed by a
/// MIT-style license that can be found in the LICENSE.md file.

/// flutter_session file package.
///
/// Adds session-like functionality to Flutter
library flutter_session;

import 'dart:convert';

import 'package:shared_preferences/shared_preferences.dart';

/// flutter_session
/// A package that adds session functionality to Flutter
class FlutterSession {
  /// Initialize session container
  Map _session = {};

  // Yes, it uses SharedPreferences
  SharedPreferences prefs;

  // Initialize the SharedPreferences instance
  Future _initSharedPrefs() async {
    this.prefs = await SharedPreferences.getInstance();
  }

  /// Item setter
  ///
  /// @param key String
  /// @returns Future
  Future get(key) async {
    await _initSharedPrefs();
    try {
      return json.decode(this.prefs.get(key));
    } catch (e) {
      return this.prefs.get(key);
    }
  }

  /// Item setter
  ///
  /// @param key String
  /// @param value any
  /// @returns Future
  Future set(key, value) async {
    await _initSharedPrefs();

    // Detect item type
    switch (value.runtimeType) {
      // String
      case String:
        {
          this.prefs.setString(key, value);
        }
        break;

      // Integer
      case int:
        {
          this.prefs.setInt(key, value);
        }
        break;

      // Boolean
      case bool:
        {
          this.prefs.setBool(key, value);
        }
        break;

      // Double
      case double:
        {
          this.prefs.setDouble(key, value);
        }
        break;

      // List<String>
      case List:
        {
          this.prefs.setStringList(key, value);
        }
        break;

      // Object
      default:
        {
          this.prefs.setString(key, jsonEncode(value.toJson()));
        }
    }

    // Add item to session container
    this._session.putIfAbsent(key, () => value);
  }
}

from flutter_session.

Related Issues (11)

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.