and<T> function

FutureOr<T> and<T>(
  1. String description,
  2. FutureOr<T> body(
      )
    )

    Implementation

    FutureOr<T> and<T>(String description, FutureOr<T> Function() body) {
      final state = Zone.current[stateKey] as State?;
    
      if (state == null) {
        throw Exception('Use and method after given, when, whenThrows or then');
      }
    
      switch (state.key) {
        case givenKey:
          return given(description, body);
        case whenKey:
          return when(description, body);
        case thenKey:
          return then(description, body);
        case null:
          throw Exception('Use and method after given, when or then');
        default:
          throw UnimplementedError();
      }
    }