Giter Site home page Giter Site logo

renggli / dart-more Goto Github PK

View Code? Open in Web Editor NEW
85.0 4.0 7.0 1.97 MB

More Dart — Literally.

Home Page: http://pub.dartlang.org/packages/more

License: MIT License

Dart 99.92% HTML 0.08%
dart collection iterable cache matcher math ordering formatter utilities library

dart-more's People

Contributors

renggli 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  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

dart-more's Issues

IntegerRange(10, 35, 10) isn't returning [10, 20, 30]

Hi Lukas, Long time no speak, hope you're doing well!

I love this library, but there seems to be an issue in the logic in IntegerRange for non-default step sizes. Sorry to be reporting this just after 3.9.0 got released 😄

Cheers, Michael

`printer/null.dart` breaks DDC builds

I'm using this package for the iterable extensions, but ran into an issue when trying to use it on web using webdev serve.

When running with development settings, I get the following error: Uncaught SyntaxError: Unexpected token 'null' (at bimap.sound.ddc.js:108:7). This is caused by dart-lang/sdk#39595, which apparently never caught the eyes of the Dart team enough to fix. The package works properly in webdev release builds.

When I cloned locally, renamed null.dart to null_printer.dart and made the other necessary changes, the package worked as intended.

flutter pub get failing with More 3.7.0 and Flutter 3.0.2

  • Run flutter create hello_world
  • Add more: ^3.7.0 to the pubspec.yaml file
  • Run flutter pub get

Got the following error:

$ flutter pub get 
Because every version of flutter_test from sdk depends on meta 1.7.0 and more >=3.6.0 depends on meta ^1.8.0, flutter_test from sdk is incompatible with more >=3.6.0.
So, because hello_world depends on both more ^3.7.0 and flutter_test from sdk, version solving failed.
Running "flutter pub get" in hello_world...                             
pub get failed (1; So, because hello_world depends on both more ^3.7.0 and flutter_test from sdk, version solving failed.)

IntegerRange(500).contains(1000) is true

configuration

Dart: 1.18
OS: Windows 10 (64-bit)
More version: 3.8.2

example code

import "package:more/collection.dart";

void main() {
	final range = IntegerRange(500);
	print(range.contains(1000)); // true
}

Iterable<T> insertBetween(T element) on Iterable<T>

Hey guys, I made this:

extension InsertBetweenExtension<T> on Iterable<T> {
  Iterable<T> insertBetween(T element) {
    final result = expand(
      (item) => [
        item,
        element,
      ],
    );

    return result.take(result.length - 1);
  }
}

It is useful in Flutter to insert dividers or paddings between widgets when you can't use the ListView.separated constructor (Row, Column, SliverList, etc.).

Row(
  crossAxisAlignment: CrossAxisAlignment.start,
  children: products
    .map<Widget>(
      (id) => Expanded(
        child: id != null ? ProductTile(id: id) : SizedBox.shrink(),
      ),
    )
    .insertBetween(SizedBox(width: 8.0))
    .toList(),
) 

Can it be an interesting addition to this package?

why data class is hidden?

for example, class Indexed in package:more/src/iterable/indexed.dart can't be accessed from other package.
but I want to use class for generics just like indexed<E>(list).map((Indexed<E> item) {}
any solution?
thanks in advance.

Python `range` equivalent

Does more have any Python range equivalent, i.e. a function returning an iterable from int start until int end, exclusive?

Multiset difference method should take Iterable<Object?> as argument

Multiset's difference function takes Iterable` which was fine before null safety. But with null safety this unnecessarily limits the uses.
For example

Multiset<E> diffSample<E>(Multiset<E> multiset, Iterable<E> iterable) =>  multiset.difference(iterable);

will fail unless you force E to extend from Object.

I guess this logic will apply to other collection related code, but did not search for them.

Always Nulls Last for Ascending or Descending sort

I am having trouble getting Ascending vs Descending sort working, always with nulls last. Imagine code like this:

    final orderingAsc = Ordering.natural<String>().nullsLast;
    final orderingDesc = Ordering.natural<String>().reversed.nullsLast;
...
              final sorter = sortAscending ? orderingAsc : orderingDesc;
              return sorter.compare(s1, s2);

I would expect null values ALWAYS to be at the BOTTOM -- then the non-null values will be sorted in Ascending or Descending order, depending on the sortAscending flag.

What am I doing wrong?

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.