Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 07 2019 18:54
    @timsneath banned @hpoit_gitlab
  • Aug 07 2019 18:54
    @timsneath banned @hpoit
  • Jan 31 2019 22:29

    dart-bot on master

    Add pkg/analysis_server/pubspec… (compare)

  • Jan 31 2019 22:12

    dart-bot on master

    First stab at tests for "Spread… (compare)

  • Jan 31 2019 22:10
    jackokring opened #35830
  • Jan 31 2019 21:14

    dart-bot on master

    [vm, gc] Use work stealing for … (compare)

  • Jan 31 2019 21:05

    dart-bot on master

    [vm] Simplify VirtualMemory::Tr… (compare)

  • Jan 31 2019 20:15
    renatoathaydes opened #35829
  • Jan 31 2019 20:13

    dart-bot on master

    [vm] Maintain view-ness of byte… (compare)

  • Jan 31 2019 19:59

    dart-bot on master

    Add the capability in analysis … (compare)

  • Jan 31 2019 19:35
    jmesserly closed #33685
  • Jan 31 2019 19:19
    srawlins opened #35828
  • Jan 31 2019 18:35

    dart-bot on master

    Add a "summary-deps-output" opt… (compare)

  • Jan 31 2019 18:33

    dart-bot on master

    Extract EnumListParameter value… (compare)

  • Jan 31 2019 18:09

    dart-bot on master

    Fix override_on_non_overriding_… (compare)

  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 opened #35827
  • Jan 31 2019 17:23
    srawlins edited #35826
Randal L. Schwartz
@RandalSchwartz
heh: : Switch to heatmapped visualization mode :)
Randal L. Schwartz
@RandalSchwartz
Bah, it’s trying to use ansi-color and blowing it badly. :(
Mushaheed Syed
@predatorx7
Mushaheed Syed
@predatorx7
Dart's Regexp is implemented from the specification of Javascript Regexp. The above regexp works on Javascript properly, shouldn't it work on dart too?
Jonathan Rezende
@jodinathan
2.18 is out
zzterrozz
@zzterrozz
Hi,
With Flutter & Firestore, I would like to copy everything from my collection path /production to the collection path /test
There is no easy way to copy & rename in Firestore.
How can I then do a recursive copy of all the collections/documents/subcollections?
Olzhas Suleimen
@ykmnkmi
New --residentoption added to dart run command.
Dart SDK version: 2.19.0-146.0.dev (dev)
Jacob MacDonald
@jakemac53
That is still quite experimental I think but feel free to try it out and file any issues!
If you are wondering what it is, basically it should speed up repeated calls to dart run <some_script.dart>, it will keep the compiler alive and do incremental rebuilds instead of starting from scratch each time.
Olzhas Suleimen
@ykmnkmi
Love this, I have a utility that (seems) to do the same. https://pub.dev/packages/fire .
Jacob MacDonald
@jakemac53
the new feature will work for totally separate runs - it keeps the compiler alive in the background for some amount of time
I believe it will also cache the dill file on disk when it does shut down in order to resume from there on the next run, similar to how pub run works.
GZGavinZhao
@gzgavinzhao:matrix.org
[m]
POG.jpg
Olzhas Suleimen
@ykmnkmi
@jakemac53 will there be a client for this server? same as frontend_server_client.
Simon Binder
@simolus3
@ykmnkmi It looks like most of the client is implemented in this file which seems simple enough
Jacob MacDonald
@jakemac53
It won't be something that is intended to be public afaik so you might get broken if you rely on details of it
also I don't think there would be an advantage to using that over frontend server, it's essentially the same, this is just a VM specific integration point for frontend server
Mushaheed Syed
@predatorx7

Hi everyone,

I wanted a 64-bit random integer generator so I wrote the following code:


// equivalent to pow(2, 32);
int _max32BitNumber = 4294967296;

int nextInt32(Random random, int max) {
  if (max > _max32BitNumber) {
    final maxAsString = max.toString();
    final charCount = maxAsString.length;
    final seperator = (charCount / 2).floor();

    final leftHalf = int.parse(maxAsString.substring(0, seperator));
    final rightHalf = int.parse(maxAsString.substring(seperator));

    final rndLeft = nextInt32(random, leftHalf);
    final rndRight = nextInt32(random, rightHalf);
    return int.parse('$rndLeft$rndRight');
  } else {
    return random.nextInt(max);
  }
}

It works well but is there a better way to do this?

Randal L. Schwartz
@RandalSchwartz
Yes. Use the built-in Random class.
Never invent your own random, @predatorx7 . Knuth taught us that in his classic series of books.
Simon Binder
@simolus3
@predatorx7 Is already using the Random class, all good here. The problem is that nextInt can only generate 32-bit numbers and they want to generate larger random numbers by combining the smaller ones. Your intention to concatenate is correct, something trivial like random.nextInt(_max32BitNumber) + random.nextInt(max - _max32BitNumber) would no longer be uniform! Also have a look at this approach which doesn't require splitting the desired size at a decimal point. I'm not sure if your approach has any obvious security issue, but I'm too tired to think about stochastics right now :D
Ayub
@Ajob41
Hi guys, How is everyone?
I will jump right to the topic, my issue is that I am trying to remove the dart icon from the top left bar, I am building application with dart on the web, so please be kind and help.
Randal L. Schwartz
@RandalSchwartz
I believe that’s defined in your index.html
Ayub
@Ajob41
Do you mind if show me how?
Randal L. Schwartz
@RandalSchwartz
Are you talking about the favicon?
GZGavinZhao
@gzgavinzhao:matrix.org
[m]
@Ajob41: You can search "how to change website icon html". I believe it has nothing to do with Dart.
Ayub
@Ajob41
I am using dart on the web.
GZGavinZhao
@gzgavinzhao:matrix.org
[m]
That doesn't matter. It is your index.html file that changes the website icon.
Jonathan Rezende
@jodinathan
sometimes some errors happen that really gives us a hard time
Crash when compiling null,
at character offset null:
Unsupported operation: Unsupported type UnknownType(?) (UnknownType.
#0      _AllFreeTypeVariablesVisitor.defaultDartType (package:kernel/type_algebra.dart:315:5)
#1      UnknownType.accept (package:front_end/src/fasta/type_inference/type_schema.dart:83:14)
#2      _AllFreeTypeVariablesVisitor.visit (package:kernel/type_algebra.dart:311:37)
without any clue of what is happening
Jacob MacDonald
@jakemac53
Can you file an SDK bug for that? Looks like a kernel bug
Jacob Bang
@julemand101
@jakemac53 Already reported: dart-lang/sdk#49985
Randal L. Schwartz
@RandalSchwartz
Using an operator override to extend a class: Randal shows how to use an operator override to extend the String class to make default values easier to write in constructors. https://youtu.be/__-114IPaPo
4 replies
Jonathan Böcker
@Schwusch
I really hope the JS interop stuff gets stable soon. I've hit so many bugs lately, it's barely fun anymore.
Jonathan Böcker
@Schwusch
This has baffled me the most so far. The DX when it comes to JS interop is a hard sell when trying to argue why we should go with Flutter/Dart instead of some Typescript solution.
dart-lang/sdk#50038
Jonathan Rezende
@jodinathan
I completely agree @Schwusch
we are waiting for static meta programming to make our internal framework public
we have dozens of devs on that framework
but the JS interop is way too weak that we are pondering in going full TS instead of Dart
Harshit Seksaria
@letsintegreat
Hi, I am new here. I would like to contribute to Dart SDK, but I am having a hard time getting started. I have basic knowledge of Flutter and Dart, and I am willing to learn new tech stacks in order to be able to contribute to dart. Could someone please help me get started?
3 replies
Piero Marcelo Ulloa Mora
@Piero512
Hi
I was hoping more experimented people would tell me why this doesn't typecheck:
class DotnetInterop {
  final load_assembly_and_get_function_pointer_dart_fn loadAsmCb;
  static const unmanagedCallersOnly = 'UNMANAGED_CALLERS_ONLY';
  DotnetInterop(this.loadAsmCb);

  /// This function allows you to find static functions on the assembly
  /// at [assemblyPath], with the [typename] as an AssemblyQualifiedTypeName
  /// and a [methodName] with the name of the static method.
  /// You can optionally set a compatible delegate name in [delegateType],
  /// if you don't, the delegate will be generated with a default type of
  /// int MethodName(IntPtr args, int sizeInBytes)
  /// (Link to docs)[https://source.dot.net/#System.Private.CoreLib/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs,35]
  /// or if your function already has the UNMANAGED_CALLERS_ONLY annotation,
  /// use [DotnetInterop.unmanagedCallersOnly] and otherwise call it as usual.
  DF loadAssemblyAndGetFunctionPointer<NF extends Function,
          @DartRepresentationOf('NF') DF>(
      String assemblyPath, String typeName, String methodName,
      [String? delegateType]) {
    final functionPointer = _loadAssemblyAndGetFunctionPointer(
      assemblyPath,
      typeName,
      methodName,
      delegateType,
    );
    return functionPointer.cast<NativeFunction<NF>>().asFunction<DF>();
  }
}
Simon Binder
@simolus3
@Piero512 Exposing native functions to Dart requires the compiler to generate the interop code for the ABI. For performance reasons (maintaining "tree-shakability"), this happens exclusively in the compiler and never at runtime. So, the argument to asFunction must be a compile-time constant and can't be set dynamically. It's not possible to write the method you want to write as it is. You'd have to change the function to return a pointer, the caller would have to invoke asFunction with the type literal.
(Also, you need @DartRepresentationOf('NF') DF extends Function for the first error to go away)